Skip to content

feat(env): give each computer in a multi env a control token of its own - #796

Closed
andrewpark-scaleai wants to merge 1 commit into
andrewpark/vuln-3253-sidecars-behind-gatewayfrom
andrewpark/vuln-3253-computer-tokens
Closed

andrewpark-scaleai wants to merge 1 commit into
andrewpark/vuln-3253-sidecars-behind-gatewayfrom
andrewpark/vuln-3253-computer-tokens

Conversation

@andrewpark-scaleai

@andrewpark-scaleai andrewpark-scaleai commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Why

A multi env's computers shared the gateway's control token. This PR gives each computer a token of its own, so each credential opens only what it is for, and keeps the token out of the computer session's process environment.

What changed

  • Each computer mints its own control token at deploy.
  • The gateway gets them in CHILD_CONTROL_TOKENS and sends each computer's token on that computer's /svc routes.
  • The session holds only AGENTENV_CONTROL_TOKEN_SHA256, and the driver card advertises control_token: "sha256".
  • granted_headers picks the longest matching grant prefix.

Scope

  • Multi env computers and computers deployed alone.
  • CONTROL_TOKEN_CHILDREN stays in the gateway for computers an older agent-env booted. Delete it once no deploy sets it.

Blast Radius

  • New framework, older gateway image: steps still reach each computer through the record's per-computer grant.
  • Older framework, new gateway image: the gateway still honors CONTROL_TOKEN_CHILDREN.
  • Computer images composed before this change keep the plain token until recomposed. That token now belongs to the computer alone.
  • Each computer's token sits in child_envs[<name>].control_token of the multi env's record. A hub that strips the top-level token from reads should strip these too.

Verification

  • Unit trees tst/unit/env, tst/unit/providers, tst/unit/task, tst/unit/task_step, tst/unit/drivers and the protocol's tests pass, except environment-specific failures that also fail on the base branch.
  • multi_env_computers_test.py asserts each computer holds its own token.
  • A local Docker container check found no token in the session's process environments.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the remaining test-coverage issue is non-blocking.

Fix All in CursorFindings

  1. P2 Route cases repeat one request. ▶
Fix with agent prompt
### Issue 1
tst/unit/env/gateway/control_token_test.py:110-112
This test takes `path` from `OPEN`, but every case requests `/echo`. All 12 cases check the same route, so the listed routes add no coverage and failures get misleading case names. Remove the unused parameter if `/echo` is the intended check, or make each case exercise its named route.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Each computer now gets its own control token. Compatible drivers boot with only its hash, while the gateway forwards the right token to each computer.

  • Each computer uses its own token on gateway routes.
  • Computer drivers can check tokens without holding them.

No new actionable issues were found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  F[Framework] -->|Gateway token| G[Gateway]
  F -->|Computer token on its route| G
  G -->|Computer A token| A[Computer A]
  G -->|Computer B token| B[Computer B]
  A --- HA[Stores token hash when supported]
  B --- HB[Stores token hash when supported]
Loading

Reviews (2) · Last reviewed commit: "feat(env): give each computer in a multi..." · Reviewed by Greptile

@andrewpark-scaleai
andrewpark-scaleai force-pushed the andrewpark/vuln-3253-sidecars-behind-gateway branch from 9459d49 to 7985a79 Compare November 18, 2026 23:54
@andrewpark-scaleai
andrewpark-scaleai force-pushed the andrewpark/vuln-3253-computer-tokens branch from 852bdba to e94f88c Compare November 19, 2026 00:39
@andrewpark-scaleai andrewpark-scaleai changed the title fix(env): computers take tokens of their own and their session holds none (VULN-3253) feat(env): give each computer in a multi env a control token of its own Nov 19, 2026
@andrewpark-scaleai
andrewpark-scaleai marked this pull request as ready for review November 19, 2026 18:21
@andrewpark-scaleai
andrewpark-scaleai requested a review from a team as a code owner November 19, 2026 18:21
Comment on lines +110 to +112
@pytest.mark.asyncio
@pytest.mark.parametrize("path", sorted(OPEN))
async def test_a_gateway_started_without_a_token_lets_a_childs_through_nowhere_but_the_child(path):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Route cases repeat one request. This test takes path from OPEN, but every case requests /echo. All 12 cases check the same route, so the listed routes add no coverage and failures get misleading case names. Remove the unused parameter if /echo is the intended check, or make each case exercise its named route.

Prompt To Fix With AI
This is a comment left during a code review.
Path: tst/unit/env/gateway/control_token_test.py
Line: 110-112

Comment:
**Route cases repeat one request.** This test takes `path` from `OPEN`, but every case requests `/echo`. All 12 cases check the same route, so the listed routes add no coverage and failures get misleading case names. Remove the unused parameter if `/echo` is the intended check, or make each case exercise its named route.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Cursor Fix in Claude Code Fix in Codex

Each computer mints its own control token at deploy. The gateway receives
them in CHILD_CONTROL_TOKENS and sends each computer's token on that
computer's /svc routes. A driver whose card advertises control_token
"sha256" boots with only the token's digest (AGENTENV_CONTROL_TOKEN_SHA256).
granted_headers picks the longest matching grant. CONTROL_TOKEN_CHILDREN stays
for computers an older agent-env booted.
@andrewpark-scaleai
andrewpark-scaleai force-pushed the andrewpark/vuln-3253-computer-tokens branch from afb8fad to e3c6e38 Compare November 19, 2026 18:48
@andrewpark-scaleai
andrewpark-scaleai force-pushed the andrewpark/vuln-3253-sidecars-behind-gateway branch from 7985a79 to 5d14668 Compare November 19, 2026 18:48
@andrewpark-scaleai
andrewpark-scaleai deleted the andrewpark/vuln-3253-computer-tokens branch November 19, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant