Repository navigation
fix(security): Older REST data routes behind the gateway proxy (/api/reset, /export-state, /export-snapshot) take no control token - #776
Open
scale-avr[bot] wants to merge 2 commits into
Open
scale-avr[bot] wants to merge 2 commits into
scale-avr[bot] wants to merge 2 commits into
Conversation
…hind /svc/mcp-<name>/
…xport-state calls
Collaborator
|
🤖 Automated Claude routine — Env Pod PR Context Review. This is a bot, not Edgar Arakelyan; not a human review. Context from outside this diff: two other open PRs are already guarding these same routes, so whoever reviews this probably wants to decide which version is the one to keep.
One concrete gap inside this PR, independent of which list wins: Both of those are still drafts, so this PR may simply be ahead of them; flagging it only because the overlap isn't visible from this diff alone. Generated by Claude Code |
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 risk: Medium. Review verification before merge.
Not checked: The reproduction of an earlier fix reproduces on the new code and on the code before this change. This change did not undo that fix. Review must confirm that the earlier fix still holds.
Finding:
src/agent_env/env/gateway/gateway.pyRoot cause: The REST helpers reset_via_rest, add_via_rest and _export_state_at in legacy_protocol.py now pass their final URL through protocol_v1.request_headers. A call that names no headers takes the token granted to its env. This fixes shared-name loads, where MultiEnv grants the token through protocol_v1.a…
Details: proof ladder, not fixed, files
How sure is this fix?
.avr/tests/legacy_data_routes_poc.pywritten by AVR's accepted proof. Before the fix it coverage not checked: the finding names no file and line.tst/unit/env/test_legacy_protocol.py::test_a_rest_call_without_headers_takes_the_token_its_env_was_grantedNot fixed by this PR
Files changed (3)
src/agent_env/env/legacy_protocol.pytst/unit/env/test_legacy_protocol.pytst/integration/env/envs/multi_env_local_test.pyOther findings this PR fixes
an earlier finding
Merge risk: Medium. Review verification before merge.
Not checked: The reproduction of an earlier fix reproduces on the new code and on the code before this change. This change did not undo that fix. Review must confirm that the earlier fix still holds.
Finding:
src/agent_env/env/gateway/gateway.pyRoot cause: The gateway now takes its control token on the older REST routes behind /svc/mcp-<name>/: api/reset, export-state, export-snapshot, snapshot-dirty, reset-memory and validate-rows. It matches them with the same dot-segment normalisation, case folding and encoding rules as the MCP endpoint. A gateway…
Before merge:
Details: proof ladder, not fixed, files
How sure is this fix?
.avr/tests/legacy_data_routes_poc.pywritten by fireworks_ai/deepseek-v4p1-flash-1017. Before the fix it coverage not checked: the finding names no file and line.python -m py_compile <changed files>python -m pytest tst/unit/env/test_legacy_protocol.py tst/unit/env/gateway/control_token_test.pycontrol_token_test.py: legacy routes (plain, dot-segment, encoded, mixed case) get 401 without a token and pass with it; no token means no guard; website routestest_legacy_protocol.py: reset, add and export send the Bearer token; legacy service_state sends itNot fixed by this PR
Files changed (8)
src/agent_env/env/gateway/gateway.pysrc/agent_env/env/legacy_protocol.pysrc/agent_env/env/envs/_deployment.pysrc/agent_env/env/envs/website.pysrc/agent_env/env/envs/mcp_server.pysrc/agent_env/task_step/task_steps/snapshot_env.pytst/unit/env/gateway/control_token_test.pytst/unit/env/test_legacy_protocol.py

Confidence Score: 5/5
The reviewed changes appear safe to merge; CI still needs to run the tests.Summary
The PR requires control tokens on older MCP data routes and updates callers to send them. The follow-up fixes shared-name loads by letting REST helpers use the token granted by
MultiEnv.Reviews (2) · Last reviewed commit: "fix(gateway): send the granted control t..." · Reviewed by Greptile