From 28e2b99e3bbf4f40cad60385690333e0b96bcaa6 Mon Sep 17 00:00:00 2001 From: Mahmoud ElNeMR <83190847+ElNeMeR70@users.noreply.github.com> Date: Tue, 24 Nov 2026 03:33:55 +0200 Subject: [PATCH] fix(adapter-utils): allowlist Slack task tools route in callback bridge (#19936) ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Remote and sandboxed agents call the Paperclip control plane through the sandbox callback bridge (`DEFAULT_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST` and `HTTP2_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST` in `packages/adapter-utils/src/sandbox-callback-bridge.ts`) > - While task-bound email routes and company skill routes are allowlisted, the task-bound Slack tool execution route (`POST /api/companies/:companyId/slack/tasks/:taskId/tools`) was missing from `DEFAULT_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST` > - Because the callback bridge rejects unlisted routes before forwarding, remote agents cannot use the `slack` skill and receive `403 Route not allowed` > - This pull request adds `POST /api/companies/:companyId/slack/tasks/:taskId/tools` to `DEFAULT_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST` while keeping Slack connection and workspace administration routes denied at the bridge > - The benefit is that remote and sandboxed agents can execute task-bound Slack tools over both queue and HTTP/2 callback bridges while the controller continues to enforce company, connection, and task/run authority ## Linked Issues or Issue Description - Fixes: #19925 ## What Changed - Add `POST /api/companies/:companyId/slack/tasks/:taskId/tools` to `DEFAULT_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST` in `packages/adapter-utils/src/sandbox-callback-bridge.ts`. - Add positive and negative route authorization test cases for `/api/companies/:companyId/slack/tasks/:taskId/tools` and `/api/companies/:companyId/slack/connections` across queue and HTTP/2 allowlists in `packages/adapter-utils/src/sandbox-callback-context-routes.test.ts`. ## Verification - Verified `packages/adapter-utils/src/sandbox-callback-context-routes.test.ts` across both queue and HTTP/2 callback bridge allowlists. ## Risks - Low risk. Only `POST /api/companies/:companyId/slack/tasks/:taskId/tools` is admitted through the callback bridge; all Slack workspace and connection administration routes remain denied at the bridge, and the controller still enforces company membership, connection ownership, and task/run authority. ## Model Used - Google Gemini 3.1 Pro (Antigravity coding agent, 1M context window, extended thinking, tool use and code execution enabled) ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --- packages/adapter-utils/src/sandbox-callback-bridge.ts | 1 + .../adapter-utils/src/sandbox-callback-context-routes.test.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/packages/adapter-utils/src/sandbox-callback-bridge.ts b/packages/adapter-utils/src/sandbox-callback-bridge.ts index 9324d55e9d2..3da9b934e9b 100644 --- a/packages/adapter-utils/src/sandbox-callback-bridge.ts +++ b/packages/adapter-utils/src/sandbox-callback-bridge.ts @@ -171,6 +171,7 @@ export const DEFAULT_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST: readonly SandboxCa { method: "GET", path: /^\/api\/companies\/[^/]+\/email\/tasks\/[^/]+$/ }, { method: "GET", path: /^\/api\/companies\/[^/]+\/email\/deliveries\/[^/]+$/ }, { method: "POST", path: /^\/api\/companies\/[^/]+\/email\/send$/ }, + { method: "POST", path: /^\/api\/companies\/[^/]+\/slack\/tasks\/[^/]+\/tools$/ }, // Issue lifecycle: read context, checkout, update, comment, document, release { method: "GET", path: /^\/api\/issues\/[^/]+$/ }, diff --git a/packages/adapter-utils/src/sandbox-callback-context-routes.test.ts b/packages/adapter-utils/src/sandbox-callback-context-routes.test.ts index 02644a2f944..ca1bb7c77cd 100644 --- a/packages/adapter-utils/src/sandbox-callback-context-routes.test.ts +++ b/packages/adapter-utils/src/sandbox-callback-context-routes.test.ts @@ -8,6 +8,7 @@ const contextRequests = [ { method: "GET", path: "/api/assets/screenshot-1/content" }, { method: "GET", path: "/api/companies/company-1/skills/skill-1" }, { method: "GET", path: "/api/companies/company-1/skills/skill-1/files", query: "?path=references%2Fworkflow.md" }, + { method: "POST", path: "/api/companies/company-1/slack/tasks/task-1/tools" }, { method: "GET", path: "/api/issues/task-1/diagnostics/wakes" }, { method: "POST", path: "/api/issues/task-1/monitor/check-now" }, ]; @@ -20,6 +21,9 @@ const deniedRequests = [ { method: "PATCH", path: "/api/companies/company-1/skills/skill-1/files" }, { method: "DELETE", path: "/api/companies/company-1/skills/skill-1/files" }, { method: "GET", path: "/api/companies/company-1/skills/skill-1/files/extra" }, + { method: "GET", path: "/api/companies/company-1/slack/tasks/task-1/tools" }, + { method: "POST", path: "/api/companies/company-1/slack/tasks/task-1/tools/extra" }, + { method: "POST", path: "/api/companies/company-1/slack/connections" }, { method: "POST", path: "/api/issues/task-1/diagnostics/wakes" }, { method: "GET", path: "/api/issues/task-1/diagnostics/wakes/extra" }, { method: "GET", path: "/api/issues/task-1/monitor/check-now" },