[Fix] Brain proxy bypasses per-tool approval policies on the task path - #3089
Draft
roomote-roomote[bot] wants to merge 1 commit into
Draft
roomote-roomote[bot] wants to merge 1 commit into
roomote-roomote[bot] wants to merge 1 commit into
Conversation
Contributor
roomote-roomote
Bot
requested review from
brunobergher,
daniel-lxs and
mrubens
as code owners
September 22, 2026 04:08
…ive enforcement end to end The Brain proxy runs through createMcpProxy but never set toolApprovalIntegrationId, so per-tool ask/reject policies keyed to gbrain were unenforced on the task path. Opt in through credential resolution, the same way linear does. Also cover the native-handler guard end to end through the Notion handler (reject refused before any upstream contact, ask held until the approval claim succeeds, claim errors fail closed, rejected tools hidden from tools/list, batch refused, experiment-off inert), and preserve the upstream status when filtering a native tools/list response.
roomote-roomote
Bot
force-pushed
the
fix/native-mcp-tool-approval-enforcement-0ljg5i4jowksz
branch
from
September 22, 2026 19:11
492c0d1 to
dadad21
Compare
daniel-lxs
marked this pull request as draft
September 23, 2026 16:53
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
Raised by an internal security review of the per-tool integration approval work (#3069 / #3072 / #3076 / #3078); no separate tracking issue.
Why this PR exists
What changed
The native-handler enforcement gap from that review was largely closed by #3103; this PR covers what remained after it landed.
createMcpProxybut never settoolApprovalIntegrationId, so per-toolask/rejectpolicies keyed togbrainwere still unenforced on the task execution path: a task sandbox holding a run token could call/api/mcp/gbraindirectly and run a tool an admin had disabled. It now opts in through credential resolution, exactly the waylinear.tsdoes, so the proxy's existing enforcement hook (including the Auto/shadow behavior from [Feat] Automatic approvals: a decision model risk-assesses tool calls nobody has made a choice about #3084) applies.notion-tool-approvals.test.tsexercises the native-handler guard from [Improve] Consolidate MCP tool availability into approval modes #3103 through the real Notion handler: arejectpolicy refuses a task run's call with a 403 before any Notion API contact, anask-first tool is held until the Session owner's approval claim succeeds, an unreadable claim fails closed, rejected tools disappear fromtools/list, batch requests are refused while a block is in force, and the experiment-off path reads nothing and blocks nothing. Develop previously had only the guard's unit test.tools/listfilter now preserves the upstream response status when it re-serializes the filtered payload instead of always returning 200.How it was tested
tool-approval-enforcementtests.pnpm --filter @roomote/api check-typespasses; pre-push gates (oxlint, residual ESLint,check-types:fast, knip) pass.Checklist
[Fix],[Feat],[Improve],[Refactor],[Docs], or[Chore]followed by a user-facing descriptionpnpm lintandpnpm check-typespass locallypnpm changeset