Repository navigation
feat(gateway): take the control token on the older /svc REST state routes - #822
Open
andrewpark-scaleai wants to merge 16 commits into
Open
andrewpark-scaleai wants to merge 16 commits into
andrewpark-scaleai wants to merge 16 commits into
Conversation
andrewpark-scaleai
marked this pull request as ready for review
November 20, 2026 16:53
andrewpark-scaleai
force-pushed
the
andrewpark/legacy-rest-callers-send-token
branch
from
November 20, 2026 17:14
58f18f0 to
f3ff3b3
Compare
andrewpark-scaleai
force-pushed
the
andrewpark/legacy-rest-routes-take-token
branch
from
November 20, 2026 17:30
ab1fd64 to
c614945
Compare
…text remotely, with its tools declared (#841) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…and an agent builds only those (#849) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…elay_ms, so it shows what the input did (#844) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The legacy REST helpers (reset_via_rest, add_via_rest, export_state, reset) take headers and default to the run's grant. Legacy loads, resets, state reads and streamed snapshots send the deployment's token. A grant covers a URL only when it resolves under the grant's address, by whole path segments. A legacy reset refused with 401 or 403 raises instead of falling back to the MCP tool.
…utes LEGACY_STATE_ROUTES lists the older state routes a backing server serves beside its data plane. On a gateway with a control token, every /svc/<key>/ route takes the token for each of them, after path normalization. A site's /website route serves none of them. A gateway booted without a token behaves as before.
A site at http://host/base receives ../base/x as /base/x, which is /x under its base. The route's path check now reads the path the site receives against the site's own address, decoded, with the base path taken off, so it matches the same paths the site's card names.
andrewpark-scaleai
force-pushed
the
andrewpark/legacy-rest-routes-take-token
branch
from
November 20, 2026 23:04
c614945 to
475e53d
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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.
Merge order for this pair:
Why
The gateway's data plane routes take the control token. This PR applies the same rule to the older REST state routes behind
/svc/<key>/, so every state-changing or state-reading route behind the gateway uses one auth scheme.What changed
LEGACY_STATE_ROUTESingateway/constants.pylists the older state routes:/api/reset,/api/add,/api/bridge/apply,/export-state,/export-snapshot,/snapshot-dirty,/reset-memory,/validate-rows,/api/_state,/api/_resetand/api/debug/seed.token_pathsadds them to every/svc/<key>/route. Matching reusesreaches, so paths are normalized before the check./website/<site>/route serves none of these routes. The harness reaches sites through/svc/<site>/.run_bundle_built_envs_test.pyembeds sends the run's grant to/export-state.Rollout
Verification
tst/unit/env/gateway/control_token_test.py: 354 passed.tst/unit/env/gateway: 1356 passed.ruff checkis clean.

Confidence Score: 5/5
The code appears safe to merge once the stated caller rollout is complete; missing user-sim ATIF copies are non-blocking.Fix with agent prompt
Summary
Adds control-token checks to older state routes under
/svcand blocks those routes through token-protected website routes. The previous website base-path bypass is fixed.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD R[Incoming request] --> S{Route} S -->|Protected legacy path under /svc| T{Valid control token?} T -->|Yes| B[Backing service] T -->|No| U[401] S -->|Legacy path under /website with token configured| N[404] S -->|Ordinary website path| W[Website]Reviews (8) · Last reviewed commit: "fix(gateway): read a site route's path u..." · Reviewed by Greptile