Repository navigation
fix(box): Keep the env:// secret of an [egress] route in the Runtime profile - #2970
Merged
tejaskash merged 1 commit intoNov 30, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## box-integration #2970 +/- ##
================================================
Coverage 96.94% 96.94%
================================================
Files 780 780
Lines 70806 70813 +7
================================================
+ Hits 68645 68652 +7
Misses 2161 2161 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vvargu
requested review from
leo237 and
mquang-amazon
and removed request for
leo237
November 30, 2026 22:56
vvargu
marked this pull request as ready for review
November 30, 2026 22:56
…profile The Runtime profile removed the secret from each [egress] route that goes through the Box gateway. Without the secret, box does not set the variable, so an agent that reads its stand-in from the variable under agentcore dev gets KeyError on AgentCore Runtime. An HTTP [mcp] server already keeps its env:// secret. Calls to the host still work: the gateway target adds the real key. Only agent code that requires the variable fails. Keep an env:// secret on the route without inject, as for an [mcp] server. Drop a secret of another kind. Box 0.3.3 accepts this form with no value in the variable, gives the agent a stand-in, and refuses inject beside a backend, as strands-agents/box#311 documents. For this local profile entry: [egress.github] destinations = ["api.github.com"] secret.ref = "env://GITHUB_TOKEN" .box/<runtime>/aws/profile.toml before this change: [egress.github] destinations = [ "api.github.com" ] [[egress.github.backends]] url = "${{ inputs.gateway.url }}/egress-github" [egress.github.backends.auth] ref = "aws://" [egress.github.backends.auth.aws] service = "bedrock-agentcore" region = "${{ inputs.aws.region }}" .box/<runtime>/aws/profile.toml after this change: [egress.github] destinations = [ "api.github.com" ] [egress.github.secret] ref = "env://GITHUB_TOKEN" [[egress.github.backends]] url = "${{ inputs.gateway.url }}/egress-github" [egress.github.backends.auth] ref = "aws://" [egress.github.backends.auth.aws] service = "bedrock-agentcore" region = "${{ inputs.aws.region }}" Add a test that gives the route to the box on PATH.
vvargu
force-pushed
the
box/fix-b7-egress-env-secret
branch
from
November 30, 2026 23:03
8fe5179 to
824145a
Compare
tejaskash
approved these changes
Nov 30, 2026
mquang-amazon
approved these changes
Nov 30, 2026
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.
Description
A Box project can have an
[egress]route with anenv://secret, as step 4 ofdocs/box-local-testing.mdshows:Under
agentcore dev, box puts a stand-in inGITHUB_TOKEN, and the agent reads it from the variable. On AgentCore Runtime, the Runtime profile removed the secret from the route, because the gateway target sends the real key. Without the secret, box does not set the variable. So agent code that readsos.environ["GITHUB_TOKEN"]works under dev and getsKeyErroron the Runtime. An HTTP[mcp]server with the same secret already keeps it.Calls to the host still work on the Runtime: the
egress-githubgateway target adds the real key from AgentCore Identity. Only agent code that requires the variable fails, such asos.environ["GITHUB_TOKEN"]or a library that stops when the variable is missing.This change keeps an
env://secret on the Runtime route of an[egress]entry, withoutinject, asmcpServerdoes. A secret of another kind still goes.egressRouteandmcpServernow use one helper,standInSecret. This is the form that strands-agents/box#311 documents for a secret beside a backend: box gives the agent a placeholder, removes it from the request, and never reads the variable..box/<runtime>/aws/profile.tomlbefore and afterFor the local entry above, build writes this route.
Before:
After:
The only difference is the
[egress.github.secret]table. The gateway backend and its SigV4 auth do not change. A localsecret.injectis not copied, because box refuses it beside a backend.Checked with box 0.3.3 (the pinned release), with
GITHUB_TOKENunset as on the Runtime:GITHUB_TOKENunsetenv://secret (this change)strands_box_…stand-inenv://secret withinjecta destination secret.inject has no effect beside a backendenv://variableRelated Issue
No issue. Review finding B7 on #2922 (the Runtime route of an
[egress]entry loses itsenv://secret).Documentation PR
Not applicable. The docs do not describe the removed secret. The table at the top of
rules/gateway.tsis updated.Type of Change
Testing
bun test: 6,769 pass and 3 fail with box 0.3.3 on PATH. I fixed two of the failures in this PR. The third,the box on PATH > resolves a profile into the rules the tests fakeinboxProfileResolver.test.ts, fails the same way onbox-integrationwithout this change.bun run test:e2e. Not run: they deploy real resources. A local build of a CodeZip Box project now writes[egress.github.secret] ref = "env://GITHUB_TOKEN"beside the gateway backend in.box-dist/profile.toml.bun run typecheckbun run lint:checkbun run format:checkbun run auditbun run secrets:checkbun run buildsrc/assets/, I updated affected snapshots. Not applicable.command.mdTests changed or added:
rules/gateway.test.ts: the route keeps theenv://secret. A new test covers an entry with two hosts,injectremoved, and a signed secret dropped. A new test gives the route to the box on PATH and checks thatbox profile showaccepts it with no value in the variable (skipped when there is no box on PATH).manager.boxNetwork.test.ts: the two build tests expect the secret on thegithubroute.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.