Repository navigation
feat(policy): isolate overlapping credential-bound accounts - #5995
stevenlee-oai wants to merge 6 commits into
Conversation
Signed-off-by: stevenlee-oai <213687449+stevenlee-oai@users.noreply.github.com>
Signed-off-by: stevenlee-oai <213687449+stevenlee-oai@users.noreply.github.com>
Signed-off-by: stevenlee-oai <213687449+stevenlee-oai@users.noreply.github.com>
Signed-off-by: stevenlee-oai <213687449+stevenlee-oai@users.noreply.github.com>
Signed-off-by: stevenlee-oai <213687449+stevenlee-oai@users.noreply.github.com>
Signed-off-by: stevenlee-oai <213687449+stevenlee-oai@users.noreply.github.com>
Review: account-scoped credential authorization (#5988)Reviewed at Verdict: request changes. The PR solves the right problem in the right place. Supervisor-local enforcement, Gateway-stamped owners, no hot-path RPCs, and a wire value that older runtimes reject are all choices we want to keep. Three correctness issues need fixing before merge, and three design changes should land with it. Blocking1. Incremental policy updates can fold one account's rules into another's.
This predates the PR, but it only matters once two providers can share a URL, which is what this PR enables.
2. One account with two credential headers is rejected.
3. Reserving expired keys breaks existing sandboxes on upgrade.
On The reservation is right for account-bound providers, where the key name selects the account and must not change hands. Please keep it, but be strict when writing and tolerant when reading:
Should change before merge4. Check the account before request middleware.
Today policy admits on the union of both accounts, middleware runs, and only then does credential preparation ask which endpoint owners admit the request (relay.rs#L229-L273). When A calls a tool only B may use, middleware processes a request A was never allowed to make, and the caller gets The per-account decision already exists; it runs too late. Please run it before middleware as well:
Error contract:
The second row must not reveal that another account could make the call. We'd like this in the PR because the error contract is hard to change once callers depend on it.
5. Log the selection denial at Medium.
This is the first row of the table in item 4. The event is High with no finding (relay.rs#L792-L807). 6. Author the setting on
Fine as is, or follow-up
Worth stating in the docsBoth accounts' placeholders live in the same sandbox, so the agent can pick either. This feature prevents one account's token being sent on a request only the other may make. It does not confine an agent to one account. |
Summary
Let two accounts share an inspected MCP or REST endpoint while keeping their credentials and request permissions separate. Each credential has a unique placeholder. The caller selects one placeholder; the Supervisor authorizes that account's request and then injects its token. This uses deployed policy, with no request-time authorization relay.
Closes #5988.
Changes
enforce-credential-boundroutes. Account A can allowsearchwhile B allowssearchandsendat the same URL. Ordinaryenforceretains its behavior.Verification
Ran the official TypeScript MCP SDK 1.29.0 inside a disposable Docker Sandbox through locally built Gateway, Supervisor, and Sandbox binaries, against a controlled MCP server. Both accounts completed
initialize,notifications/initialized, the optional SSE GET,tools/list, and permitted tool calls.searchsendsearch,sendsendafter A is withdrawnopenshell-conformance run --include-ignored account_bound_mcp_sdk_client_isolates_accountsRuntime binaries reported
ee7791b59; the final commit1235beerecords the exact test-only withdrawal correction used in that passing run. The Gateway regressiontwo_static_provider_bindings_activate_with_distinct_policy_ownersalso passed, including the expired-Provider collision. The stable build and focused Gateway test used temporary qualification workspaces because the local registry lacked an unused experimental Cedar dependency; every selected dependency matched the repository lockfile.Hosted Branch Checks and Helm Lint still await upstream maintainer approval for fork workflows. The green hosted E2E status means
test:e2ewas not applied; it is not a hosted test result.