Skip to content

feat(box): Send a boxed agent's Memory calls to Memory directly - #2889

Open
vvargu wants to merge 13 commits into
aws:box-integrationfrom
vvargu:box/memory-direct-access
Open

vvargu wants to merge 13 commits into
aws:box-integrationfrom
vvargu:box/memory-direct-access

Conversation

@vvargu

@vvargu vvargu commented Nov 21, 2026 •

Copy link
Copy Markdown

Description

A boxed agent's AgentCore Memory calls now go to Memory directly, signed with the execution role, and not through the Box gateway. The gateway signed them with its own role, so Memory could not hold each call to the session of the runtime, and one session could read or write the memory of another.

For a runtime with its default Memory, build now:

  • adds [egress.agentcore] to the Runtime profile: the AgentCore data-plane host bedrock-agentcore.<region>.<suffix>, with secret.ref = "aws://" and no backend.
  • sends a route or HTTP MCP server of the profile to that host directly too, signed with a bare aws://, with its name and other keys, and adds no second route beside it.
  • adds no agentcore target to the Box gateway, and no Memory policy for the gateway role.

Box chooses where a connection goes from its host and port alone, before it sees the path ("the re-route is matched per connection, on host and port, before the path is known"). So box cannot send /memories directly and /code-interpreters through the gateway on one host. Code Interpreter, Browser, and the other AgentCore primitives are egress destinations on the same host as Memory, so they go there directly too. What the execution role may call there depends on its grants. Build writes no restricting policy for the host.

The agentcore name stays reserved on Box gateways, now as the Memory route's name. Build writes a managed egress- target only when the Runtime profile sends calls to it.

A runtime with no default Memory is unchanged.

Box projects built before this change are not migrated: Box on AgentCore Runtime is not launched yet.

Related Issue

Closes #

Dependencies

aws/agentcore-l3-cdk-constructs#481 must merge first. It gives a boxed runtime's role its Memory grant again (f63b066 removed it when the gateway made the Memory calls), and gives a PRIVATE_VPC runtime the AgentCore data-plane endpoint, which only the runtime's role may call through. Without it, the box's Memory calls get AccessDenied.

Documentation PR

Included: README and docs/box-local-testing.md.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

  • bun test: 6099 pass, 1 fail. The failure is the box on PATH, which runs the local box on PATH, an older build that rejects @box/base. This change does not cause it.
  • bun run test:e2e: not run. No deployed check of Memory from a boxed agent yet.
  • bun run typecheck, bun run lint:check, bun run format:check, bun run build
  • Box 0.1.11-preview.10 in a container: a signed route with a path signs only that path; a gateway backend route may not carry a path and may not share its host with another route.

The Box gateway signed the agent's Memory calls with its own role. Memory then
could not hold each call to the session of the runtime by its context keys, so
one session could read or write the memory of another session.

Build now adds no `agentcore` target to the Box gateway, and writes no
`agentcore/box-memory-policy.json` for the gateway role. The Runtime profile
gets a direct `[egress.agentcore]` route to the AgentCore host of the build
region. Box signs that route with a bare `aws://`, the execution role, and the
route has no gateway backend. The execution role already has the Memory
data-plane grants, because the runtime binds its Memory.

The route is added only for a runtime with its default Memory. A route or HTTP
MCP server of the profile that already has the AgentCore host keeps it. A user
route named `agentcore` for another host stops build.

When AgentCore Gateway can get the session from the context keys, Memory calls
can go through the gateway again.
@vvargu
vvargu requested a review from a team November 21, 2026 01:42

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for this. Moving Memory off the gateway role so Memory can scope each call to the runtime's session is the right fix, and the code for new projects is clean: the route is added only for the runtime's default Memory, it is a direct aws:// route with no backend, and the RUNTIME_ROUTE_NAME_TAKEN problem and the old-renderer parity tests are good. I checked the box egress docs: a bare aws:// route takes its SigV4 service and region from an *.amazonaws.com host, so bedrock-agentcore.<region>.amazonaws.com gets signed as bedrock-agentcore in the build region. I also checked that the L3 grants the runtime role the Memory data-plane actions for a bound Memory.

Blocking

  1. Conflicts with box-integration. A trial merge conflicts in src/core/project/runtimeProfile/rules/additions.ts (1 hunk, the rule table and imports next to #2885's [telemetry.agentcore_traces] row), src/core/project/runtimeProfile/rules/additions.test.ts (3 hunks), and src/core/project/manager.test.ts (2 hunks). They look textual, so keep both sides, but CI can't run until they're resolved. Please keep #2885's OTEL/X-Ray additions when you resolve them.

  2. Projects built before this change keep sending Memory through the gateway role, and nothing tells the user. Build saves its targets and additionalPolicies into agentcore.json, so an existing Box project already has the agentcore passthrough target on its Box gateway, agentcore/box-memory-policy.json in that gateway's additionalPolicies, and the file on disk. After this PR:

    • Nothing removes the agentcore target. It is not an egress- target, so the gateway rule treats it as the user's, keeps it, and writes [egress.agentcore] with a ${{ inputs.gateway.url }}/agentcore backend.
    • The additions rule then sees a route that already has the Memory host (routes.some(hasHost)) and adds no direct route. Memory calls still go through the gateway and are signed by the gateway role, which is the cross-session problem this PR is meant to fix.
    • box-memory-policy.json is no longer in BUILD_POLICY_FILES, so the IAM check now reads it as a user policy. It grants bedrock-agentcore:* data-plane actions, so boxGatewayIamWarnings stays quiet too. No warning appears and the role keeps the grant.

    I think build should remove what it wrote before. If the Box gateway has a target named agentcore that matches { passthrough https://bedrock-agentcore.<r>.<dnsSuffix>, CUSTOM, GATEWAY_IAM_ROLE bedrock-agentcore <r> } for some region (the shape the old getBoxGatewayAgentCoreTargetSpec produced), remove it with a step message. Also drop agentcore/box-memory-policy.json from additionalPolicies and emit { path, remove: true } for the file, which BoxNetworkFile already supports. Leave a target the user changed, as placeTarget already does for region moves. Please add a build test that starts from an old project (target, listing, and file present) and checks that the Runtime profile's [egress.agentcore] has no backend and the three leftovers are gone.

Non-blocking

  1. hasHost returns early for any route to the Memory host, including one that goes through the gateway. A user [egress.x] with destinations = ["bedrock-agentcore.<r>.amazonaws.com"] and secret.ref = "aws://" becomes a managed egress-x target with GATEWAY_IAM_ROLE, so Memory again goes out under the gateway role. That case does print a gateway IAM warning, so it isn't silent. Still, for this one host I'd only defer to a route with no backends, or report a problem when the route to the Memory host goes through the gateway. The unit test calls apply directly, so it doesn't cover what the gateway rule does before the additions rule runs.
  2. Stale doc: docs/box-local-testing.md (line 51) still says build writes "the Box gateway's Bedrock and Memory targets". README line ~262 ("its calls go out through its Box gateway") could mention the Memory exception and the VPC endpoint note from the PR description.
  3. hasHost matches destinations by exact string, so an entry for bedrock-agentcore.<r>.amazonaws.com:443 or a wildcard isn't counted, and box would then refuse two routes to one host. It's an edge case, but hostKey/buildHostMap could do the matching instead.
  4. For later: in China, box infers the signing scope only for .amazonaws.com / .api.aws, not .amazonaws.com.cn. Memory isn't offered there today (docs/china-regions.md), so nothing breaks now. If Memory ships in China, this route will need an explicit scope or a box change.

No internal references or account IDs in the diff or the commit message. I didn't find any unsafe test patterns.

region: string = DEFAULT_EGRESS_BEDROCK_REGION,
): string[] {
return [...addBoxBedrockTarget(spec, region), ...addBoxMemoryTarget(spec, region)];
return addBoxBedrockTarget(spec, region);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Blocking: for a project built before this change, nothing removes what the old build wrote. The agentcore target stays on the Box gateway in agentcore.json, agentcore/box-memory-policy.json stays in additionalPolicies, and the file stays on disk. The gateway rule keeps the unmanaged agentcore target and routes [egress.agentcore] through the gateway, so Memory is still signed by the gateway role. Could this function remove a target whose shape matches the old getBoxGatewayAgentCoreTargetSpec(region) for any region, drop the listing, and have defaultTargetsWriter emit { path: "agentcore/box-memory-policy.json", remove: true }? A build test that starts from an old project would cover it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in fafa189. removeLegacyMemoryAccess runs first in addBoxGatewayTargets. It removes an agentcore target that is deep-equal to the old target shape for its own region (any partition), and drops agentcore/box-memory-policy.json from additionalPolicies. defaultTargetsWriter now emits { path, remove: true } for the file. A target of that name that the user changed stays, and build then stops with RUNTIME_ROUTE_NAME_TAKEN and names that target. The new build test in manager.boxNetwork.test.ts starts from an old project (target, listing, and file). It checks that all three are gone and that [egress.agentcore] has no backend.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Update: ff7bd08 removes this cleanup again. Box on AgentCore Runtime is not launched yet, and a Box project built before this change can be discarded, so we add no upgrade path for it. A user target named agentcore still stops build with RUNTIME_ROUTE_NAME_TAKEN, because its route would take the name of the Memory route.

const routes = [...Object.values(egress ?? {}), ...Object.values(tableOf(mcp))];
const hasHost = (entry: unknown) =>
isTable(entry) && Array.isArray(entry.destinations) && entry.destinations.includes(host);
if (routes.some(hasHost)) return egress;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This returns early for gateway-backed routes too. That covers the stale agentcore target from earlier builds (see the comment on boxMemory.ts) and a user aws:// route to the Memory host, which becomes an egress- target signed by the gateway role. In both cases Memory goes out under the gateway role again. For this host, could it defer only to a route with no backends, and otherwise replace the route or report a problem? destinations.includes(host) also misses host:443.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in fafa189. The rule now defers only to a route or HTTP MCP server with no backends. A route to the Memory host that goes through the gateway stops build with RUNTIME_MEMORY_THROUGH_GATEWAY. The build test covers a local [egress.memory] with aws://default, through the gateway rule and then the additions rule. The host match now uses parseDestination, so host:443, any case, and a *. wildcard all count.

BOX_BEDROCK_POLICY_FILE,
BOX_MEMORY_POLICY_FILE,
]);
const BUILD_POLICY_FILES: ReadonlySet<string> = new Set([BOX_BEDROCK_POLICY_FILE]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Because this file is no longer here, a leftover agentcore/box-memory-policy.json from an earlier build is now read as a user policy. Its bedrock-agentcore actions count as granted, so the IAM warnings say nothing while the gateway role keeps Memory access. Removing the file and its listing on build (see the comment on boxMemory.ts) fixes this too.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in fafa189, as you suggested. Build removes the listing and the file, so the IAM check no longer reads the old file as a user policy.

…-direct-access

# Conflicts:
#	src/core/project/manager.test.ts
#	src/core/project/runtimeProfile/rules/additions.test.ts
#	src/core/project/runtimeProfile/rules/additions.ts

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-review at 4bca2ed (merge of box-integration at 3df8eab).

Merge: fixed, looks clean. The PR merges cleanly and has no conflict markers. #2885's OTEL/X-Ray changes are still there in additions.ts, additions.test.ts and manager.test.ts: the agentcore_traces row, defaultTracesTelemetry/withOtel in the derive test, and the box-telemetry-policy-* steps. The PR's own net diff matches what it was at 18f07c6, apart from line offsets and the comment and test changes that come from the merge. No change on the base is reverted.

Still blocking: the upgrade path (point 2 of my last review). No new commit addresses it. A project built before this PR keeps its agentcore gateway target. Build treats that target as the user's because it has no egress- prefix, so routes.some(hasHost) skips the direct route. Its Memory calls therefore still go through the gateway role. The project also keeps agentcore/box-memory-policy.json in its list and on disk. That file is no longer in BUILD_POLICY_FILES, so build reads it as a user policy and boxGatewayIamWarnings gives no warning. #2877 is still open, and its ownership record would not cover projects built before it anyway. What I suggested before still applies: remove the old target shape and the policy listing, delete the file (remove: true), and add a test that builds from an old project.

CI: CodeQL, Analyze, macOS and CodeBuild e2e pass. verify / Linux and verify / Windows were still pending when I posted this.

My earlier non-blocking notes still stand and I won't repeat them.

@codecov-commenter

codecov-commenter commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.80%. Comparing base (3df8eab) to head (fafa189).

Additional details and impacted files
@@               Coverage Diff                @@
##           box-integration    #2889   +/-   ##
================================================
  Coverage            96.80%   96.80%           
================================================
  Files                  766      766           
  Lines                66928    66945   +17     
================================================
+ Hits                 64790    64807   +17     
  Misses                2138     2138           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

A project that an earlier build wrote kept the `agentcore` target on its Box
gateway and `agentcore/box-memory-policy.json` in the gateway's
additionalPolicies and on disk. The gateway rule kept that target as the
user's, so the Memory calls still went through the gateway role, and the IAM
check read the old file as a user policy and gave no warning.

Build now removes the `agentcore` target when it is as the earlier build wrote
it for some region, removes the policy listing, and removes the policy file.
A target of that name that the user changed stays, and build then stops until
the user renames it, because its route would take the name of the Memory
route.

The Memory route rule now defers only to a direct route or HTTP MCP server to
the Memory host. A route through the Box gateway stops build with
RUNTIME_MEMORY_THROUGH_GATEWAY. The rule matches the host with `:443`, in any
case, and as a `*.` wildcard.

The README and the local testing guide now say that Memory calls go to Memory
directly, and that a runtime in VPC network mode needs a `bedrock-agentcore`
VPC endpoint.

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-review of fafa189 (git diff 4bca2ed3..fafa189f, one new commit: "fix(box): Remove the Memory gateway access that an earlier build wrote"). Follow-up to my earlier COMMENT review.

Blocker (projects upgraded from an older build keep the cross-session Memory problem): fixed.

  • Old target: removeLegacyMemoryAccess finds the old target with isDeepStrictEqual against the exact shape the old getBoxGatewayAgentCoreTargetSpec wrote: name agentcore, passthrough to the AgentCore data-plane host of the target's own region, CUSTOM protocol, and GATEWAY_IAM_ROLE/bedrock-agentcore auth. Because the region comes from the target itself, a target written for any region is removed, including the China partition (tested). It runs over every bound Box gateway, so per-runtime networks are covered. It leaves alone a user's own agentcore target with a different shape, and the same shape on a non-Box gateway (both tested). If a user's own agentcore target remains, build stops with RUNTIME_ROUTE_NAME_TAKEN. That problem now points at agentcore.json and asks the user to rename the target. It doesn't fall back to a gateway route.
  • Policy: the box-memory-policy.json entry is dropped from additionalPolicies, and additionalPolicies itself is removed if that was its only entry. The file is deleted through { remove: true } with a removing <file> step, so the deletion is visible to the user. The delete uses unlinkSync behind existsSync, so a failure throws instead of being swallowed. Deleting without checking the content is fine: the older build owned this file and rewrote it on every build, so user edits never survived anyway.
  • End to end: the new manager-level test starts from an old project (old target, policy listing, policy file on disk) and runs build. It asserts that the target is gone, the listing is gone, the file is gone, the three step messages are printed, and [egress.agentcore] is the direct route (aws://, no backends).
  • Idempotent / new projects: on a second build, or on a new project, nothing matches and nothing is printed, because the remove step only reports when the file exists. That holds by construction; there is no explicit second-build test (see nit below).

Non-blocking items from my earlier review

  • hasHost also skipped the direct route when a gateway route already covered the Memory host: addressed. A route or MCP server with backends to the Memory host is now RUNTIME_MEMORY_THROUGH_GATEWAY and stops the build. This is tested in the rule and through build.
  • Stale docs (docs/box-local-testing.md, the README VPC endpoint note): addressed.
  • hasHost matched only the exact string: addressed. hasDestination now accepts any letter case, :443, and *. wildcards, and rejects other ports (tested).
  • China signing inference: still open as far as I can see. Fine to leave for a later phase.

New nits (non-blocking)

  1. hasDestination treats a *. wildcard as matching any number of subdomain levels (*.amazonaws.com covers bedrock-agentcore.<region>.amazonaws.com). Please confirm box matches wildcards the same way. If box's * matches only one label, a user's *.amazonaws.com route would stop build from adding the direct Memory route while box doesn't send Memory calls through that route either. Separately, a direct wildcard route without secret = aws:// now also stops the Memory route from being added, and then the Memory calls go out unsigned. A warning for that case may be worth adding.
  2. The legacy file is deleted no matter who lists it, but the listing is only removed from bound Box gateways. If a non-Box gateway lists agentcore/box-memory-policy.json, it is left pointing at a missing file. That's unlikely; one line in the step message or a check would cover it.
  3. A second build run in the old-project manager test would pin the idempotency.

Other checks: no internal references or account IDs in the diff. New tests use join(root, ...relative.split("/")) and existsSync, with no hard-coded / paths, chmod, spawned shells, or network. #2877 (box-gateway-targets.json) and #2864 (reserved names) are both still open. When they land, whichever merges second should include agentcore in, or reconcile it with, the reserved/recorded names. Nothing in this diff conflicts with them.

CI at review time: Linux and Windows verify pass, CodeQL, Analyze, and CodeBuild e2e pass. macOS verify failed only on project add runtime-endpoint wizard > a rejected add reports itself and hands the form back (timed out after 5000ms). That is the known macOS screen-test timeout flake and unrelated to this change. Please re-run macOS and merge only after checks are green. Merge state is blocked only because a review is required; the PR is up to date with box-integration.

Approving: the upgrade-path blocker is resolved and the rest are nits.

const destination = typeof text === "string" ? parseDestination(text) : undefined;
if (destination === undefined || destination.port !== 443) return false;
const name = destination.host.toLowerCase();
return destination.wildcard

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: this treats *.amazonaws.com as covering any number of subdomain levels. Does box match a *. wildcard the same way? If box's * matches only one label, this would skip adding [egress.agentcore] while box doesn't send the Memory calls through the wildcard route. Also, a direct wildcard route without secret = aws:// would send the Memory calls unsigned. Maybe warn in that case.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Checked with box 0.1.11-preview.10: *.amazonaws.com matches sts.us-east-1.amazonaws.com and bedrock-agentcore.us-east-1.amazonaws.com too, for both the permit and the secret. So hasDestination matches box. In 78801c2, a direct route to the Memory host that box does not sign with aws:// now gets a warning that the Memory calls fail.

Comment thread src/core/project/boxNetworkWriters.ts Outdated
.flatMap(({ path, policy }): BoxNetworkFile[] =>
policy ? [{ path, text: `${JSON.stringify(policy, undefined, 2)}\n` }] : [],
)
.concat({ path: LEGACY_BOX_MEMORY_POLICY_FILE, remove: true }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: the file is deleted for the whole project, but removeLegacyMemoryAccess drops the listing only from bound Box gateways. A non-Box gateway that lists this file would be left pointing at a missing file. That's unlikely, but a check (or keeping the file when another gateway still lists it) would close the gap.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 78801c2. Build keeps the file while a gateway that is not a Box gateway lists it, and does not change that gateway. The upgrade test also builds twice now, and the second build changes nothing.

@tejaskash tejaskash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, sending Memory calls direct instead of through the gateway makes sense for most runtimes. Requesting changes because a PRIVATE_VPC runtime now loses Memory, the direct route opens more of the AgentCore host than Memory, and a few profiles that build today now stop (inline). If the route scoping can't land here, please record it as an open item for the v1.x merge.

* calls through the Box gateway is a problem: the gateway would sign the Memory calls with its own
* role. A route of the user named {@link MEMORY_ROUTE} for another host is a problem too.
*/
function runtimeEgress(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This adds the direct route for every runtime with a default Memory, without looking at runtime.containment. A PRIVATE_VPC runtime then goes straight to bedrock-agentcore.<region>.amazonaws.com, but the L3 secure VPC (secure-vpc.ts:164-200) has no endpoint or DNS answer for that host, so Memory is unreachable and build and deploy say nothing. Before this PR the call went through the Box gateway's agentcore target and the gateway endpoint, which worked. Could a contained runtime keep the gateway route?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Agreed, and thanks for catching it. We kept the direct path for contained runtimes too, and fixed the VPC side in the constructs. Branch vvargu:fix/secure-vpc-memory-endpoint adds AgentCoreSecureVpc.allowMemory. It creates the bedrock-agentcore interface endpoint with private DNS, and adds the host to the DNS Firewall allowlist. The endpoint policy lets only the runtime's role make only the Memory data-plane calls (ALL_MEMORY_DATA_PLANE_ACTIONS), and only on the project's Memory ARNs. A runtime with no Memory gets no endpoint, because an endpoint with no policy allows every call. I will link the constructs PR here when it is open. This PR should merge after it. The local testing guide now names that requirement.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Constructs PR is open: aws/agentcore-l3-cdk-constructs#481. Its endpoint policy now lets only the runtime's role make bedrock-agentcore:* calls through the data-plane endpoint, because the box sends all of its AgentCore-host calls there directly. It also binds a boxed runtime's Memory again: f63b066 had removed that grant while the gateway made the Memory calls. This PR should merge after #481.

});
return egress;
}
return {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This route has no path limit, and bedrock-agentcore.<region> serves more than Memory: identity tokens, API keys, Code Interpreter, Browser. When the project has any credential, the L3 gives the execution role GetWorkloadAccessTokenForUserId, GetApiKeyCredential and friends on every provider (AgentCoreRuntime.ts:471-498). So code in the box could call /identities/GetWorkloadAccessTokenForUserId and then /identities/api-key and read a key such as the GitHub token that box is meant to keep from it, signed with the execution role. Through the gateway those grants were scoped to its own providers. Could the route be limited to /memories/* with a policy file, or the L3 skip grantCredentialAccess() for a runtime whose calls go out through a bound gateway?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 78801c2. The route is now bedrock-agentcore.<region>.amazonaws.com/memories. I tested box 0.1.11-preview.10 in a container. A path on a signed route limits where box signs, not where the agent can connect. Box signs /memories and /memories/... only (not /memoriesX). A call to /identities/... leaves the box unsigned, because the agent has only stand-in keys, so AgentCore refuses it (403). With fake keys, a /memories/... call came back UnrecognizedClientException (signed), and /identities came back a plain 403 (unsigned). So code in the box can no longer get a workload token or an API key with the execution role. A box policy forbid on other paths would also block the connection (tested), but I did not add one: unsigned calls already fail. Tell me if you want it as well.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Follow-up in 48d495e and 84e0efa: build now also writes agentcore-memory-paths.dw beside the Runtime profile and lists it last in policies. One rule denies every request to the AgentCore host whose path is not /memories or under it. A second denies .. and . segments, an encoded dot or backslash, and %25; no Memory, actor, session, or record ID holds a dot, a backslash, or a %. Tested with box 0.1.11-preview.10 in a container, with a raw HTTP/1.1 client: Code Interpreter, Browser, identity, and API key paths, /memoriesX, raw /memories/../identities/... and %2e%2e forms, and a WebSocket upgrade to /browser-streams/... are all denied inside the box. Box resolves . and .. and decodes %2e before the policy runs, and forwards that same path. A mismatched Host or an absolute-form target is refused before the policy. A double-encoded %252e passed the box unchanged (AWS refused it), which is why %25 is now denied too. HTTP/2 was not tested.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Update in 5732c3c: [egress.agentcore] now names the whole AgentCore host, and build writes no restricting policy. We accept that the box can reach the other primitives on that host. What it can do there is bounded by the execution role's grants. The identity and API key grants come only from grantCredentialAccess(), when the project has credentials. The Docker findings above still hold if we later want a path policy: box can allow or deny by path in http:request, but it cannot route by 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.

Adding a point to this thread. With 5732c3c the whole host is signed, so the /identities calls are signed again too. At 78801c2 they left the box unsigned and got a 403. A project that declares any credential is the default strands-box case (env://GITHUB_TOKEN). If the L3 grants the execution role GetWorkloadAccessToken* and GetApiKeyCredential for it, as cited above, code in the box can read that token. A denylist policy would keep Code Interpreter, Browser and Memory working: forbid on /identities and /identities/* for the AgentCore host, plus the dot-segment and %25 rule from 84e0efa. Box already applies http:request path rules after it normalises the path. I added this as a blocker in my latest review.

...Object.entries(egress ?? {}).map(([name, entry]) => ({ key: ["egress", name], entry })),
...Object.entries(tableOf(mcp)).map(([name, entry]) => ({ key: ["mcp", name], entry })),
].filter(({ entry }) => isTable(entry) && hasDestination(entry.destinations, host));
const throughGateway = routes.filter(({ entry }) => (entry as TomlTable).backends !== undefined);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any route to the AgentCore host that gets a gateway backend now stops build with RUNTIME_MEMORY_THROUGH_GATEWAY. A local [egress.tools] for that host, or just a policy.dw permit for it, builds on box-integration and stops here with "Remove that entry". Someone who needs the host under agentcore dev (Code Interpreter, Browser, another runtime) can't keep both. In the policy-only case the message names [egress.egress-bedrock-agentcore-...], which isn't in the profile, so there's nothing to remove. And the same entry builds or stops depending on whether the runtime has a default Memory. Could the Runtime route for such an entry use the direct form when there's a default Memory, keeping its name and other keys, instead of stopping?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 78801c2, as you suggested. RUNTIME_MEMORY_THROUGH_GATEWAY is gone. With a default Memory, a route or HTTP MCP server that the gateway rule sends to the AgentCore host now goes to the host directly on the Runtime, signed with a bare aws://, with its name and other keys. Build warns that this route signs every API of the host, and that removing it gives the /memories-only route. Box refuses the Memory route beside a signed route that covers its path (… overlaps … one destination is one authority), so build adds none there. The policy-only case works the same way, under the target's route name. One gap is left: build still writes the egress- gateway target for that host, which the Runtime then does not use. Dropping it would also drop the route from the profile. I can do it in a follow-up.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Follow-up done in c411bae: build no longer writes the unused egress- gateway target. The gateway targets writer now writes a managed target only when a route or MCP server of the derived Runtime profile sends calls to it through a backend. A target that an earlier build wrote for a host that now goes directly is removed, with the step message "on AgentCore Runtime the box sends the calls to directly, not through the gateway". So the gateway IAM check gives no warning for it either. The build test covers it, and a second build changes nothing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Changed again in 48d495e, after a design review. We do not want the box to reach Code Interpreter, Browser, or the other AgentCore APIs directly: only Memory and the gateway. And box cannot split one host between a direct route and a gateway route. A gateway route may not carry a path ("the re-route is matched per connection, on host and port, before the path is known"), and a host with a gateway route may name no other route. So, for a runtime with its default Memory, a route or HTTP MCP server to the AgentCore host, or a permit that names it, now stops build with RUNTIME_AGENTCORE_HOST_ROUTED. The problem names the local entry or the permit (The permit "<id>"), not the derived route name, so the policy-only case points at something the user can change. A runtime with no default Memory still routes that host through the gateway, as before. Build no longer converts such a route to a direct one.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Changed again in 5732c3c after a further design review. Box routes a connection by host and port only, and Code Interpreter, Browser, and Memory share the AgentCore host. So we treat those primitives as normal egress destinations: for a runtime with its default Memory, every call of the box to the AgentCore host goes there directly, signed with the execution role. A route or HTTP MCP server of the profile to that host no longer stops build. It goes direct with its name and other keys, as you suggested at first. Build adds no second route beside it, and writes no gateway target for it. The agentcore-memory-paths.dw policy is gone.

…-direct-access

# Conflicts:
#	src/core/project/boxMemory.ts
…d send a profile route to the host directly

The direct Memory route opened every API of the AgentCore data-plane host
to the execution role, such as the identity and API key calls. It now names
`bedrock-agentcore.<region>.amazonaws.com/memories`, so box signs only the
Memory calls. A call to another API of the host goes unsigned, and AgentCore
refuses it.

A route of the profile to the AgentCore host that the gateway rule sends
through the Box gateway stopped build with RUNTIME_MEMORY_THROUGH_GATEWAY.
That broke profiles that need the host under `agentcore dev`, for Code
Interpreter or Browser. On the Runtime such a route now goes to the host
directly, signed with a bare `aws://`, with its name and other keys, and
build warns that it signs every API of the host. Box refuses the Memory
route beside a signed route that covers its path, so build adds none there.
A direct route to the host that box does not sign with `aws://` gets a
warning, as the Memory calls then fail.

Build keeps the Memory policy file of an earlier build while a gateway that
is not a Box gateway lists it. The upgrade test now builds twice.

The reserved Box gateway target names keep `agentcore`, now as the name of
the Memory route. The README and the local testing guide say that box signs
only `/memories`, and that a PRIVATE_VPC runtime needs the secure VPC's
AgentCore endpoint.
@vvargu
vvargu requested a review from tejaskash November 23, 2026 20:44
… sends directly

A route of the profile to the AgentCore host goes to the host directly on
AgentCore Runtime when the runtime has its default Memory. Build still wrote
the host's `egress-` gateway target, which the Runtime did not use, and the
gateway IAM check then warned about the gateway role's grants for it.

The gateway targets writer now writes a managed target only when a route or
MCP server of the derived Runtime profile sends calls to it through a
backend. A target that an earlier build wrote for a host that now goes
directly is removed, with a step message that says why.
…Memory

Box on AgentCore Runtime is not launched yet, and a Box project built before
this change can be discarded. So build no longer removes the `agentcore`
gateway target, the `agentcore/box-memory-policy.json` listing, or that file
from an earlier build. A user target named `agentcore` still stops build,
because its route would take the name of the Memory route.

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-review at ff7bd08, after my APPROVE at fafa189. I reviewed the three new commits on top of the box-integration merge (git diff 41310f35..ff7bd08b): 78801c2, c411bae, and ff7bd08. The merge brought in #2888, #2864, #2863, and #2872. The branch contains the current box-integration and merges into it without conflicts.

My earlier notes

  • Wildcard depth: addressed. You checked that box matches *.amazonaws.com across several labels, which is what hasDestination does. A direct route to the host that isn't signed with aws:// now gets a warning, and that case is tested.
  • Policy file deleted for the whole project, listing removed only from Box gateways: moot. ff7bd08 drops the legacy cleanup entirely.
  • No second-build test: addressed for the new gateway-route case (manager.boxNetwork.test.ts builds twice and compares agentcore.json).
  • China signing inference: still open. Fine for a later phase.
  • macOS flake: see CI below.

The changes for the other review

  • The /memories path on [egress.agentcore] is applied and tested in the rule and through build/deploy for several regions. The README and local testing guide are updated.
  • RUNTIME_MEMORY_THROUGH_GATEWAY is removed. A gateway route to the AgentCore host is now rewritten to go direct with aws://, and build warns that the route signs every API of that host. gatewayRoutedTargets drops the egress- target that no backend uses. Both are tested in unit tests and through build.
  • ff7bd08 removes the upgrade cleanup that fixed my earlier blocker. Box on Runtime hasn't launched, so I accept that decision. One caveat is inline: a leftover legacy agentcore target doesn't stop the build as the commit message says.

Blocking (1, inline on additions.ts:279): when the AgentCore host's route carries a credential, the rewrite drops it silently. This applies to an env:// API key on an [egress] entry or an HTTP [mcp] server, for example an MCP server hosted on another AgentCore Runtime with bearer auth. The key is replaced by SigV4 from the execution role, and c411bae then removes the target that used to send the key. The warning doesn't mention the lost credential. I didn't find a later fix on box-integration-development, which doesn't have this code yet.

Non-blocking (inline): the commit message's claim about a legacy agentcore target is inaccurate. Also, a coupling note on gatewayRoutedTargets.

Other checks: no account IDs or internal links in the diff. No new types. The only type change is the removal of the RUNTIME_MEMORY_THROUGH_GATEWAY code, and nothing else references it.

CI at review time: Analyze and verify (Linux, Windows, macOS) were still pending for ff7bd08, and e2e was skipped. I didn't wait for them. Please merge only after they are green. A macOS 5000ms screen-test timeout is a known flake.

Leaving this as a comment, not an approval, because of the credential drop. Once the rewrite keeps a credentialed route on the gateway (or stops the build for it), with a test, I expect to approve.

routed = true;
const label = `[${kind}.${name}]`;
if (entry.backends !== undefined) {
const { backends: _backends, secret: _secret, ...kept } = entry;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Blocking: this drops the entry's secret, and the gateway target was the thing that sent the credential. Take an HTTP [mcp.x] or an [egress] entry to bedrock-agentcore.<region>.amazonaws.com with an env:// key, such as an MCP server hosted on another AgentCore Runtime with bearer auth. On the Runtime the gateway rule gives it a backend and an API_KEY target. With a default Memory, this rewrite replaces that with aws:// from the execution role, and c411bae then removes the target. The key is never sent, the calls fail with 401/403, and the warning above only says the route "signs every API of that host". Could the rewrite apply only when the host's target is IAM or has no auth (host.outboundAuth.kind !== "apiKey")? For an API key target, it could keep the gateway route or stop build with a problem that names the entry. A rule test and a build test with an env:// MCP server would cover this.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Regressed in 5732c3c. It is fixed at 84e0efa by stopping build, but the rewrite is back and drops secret again, now with no warning. A build probe with an env:// HTTP MCP server to the AgentCore host builds clean and sends aws:// in place of the token. See my new comment on additions.ts:273.

egress: Object.keys(tables.egress).length > 0 ? tables.egress : egress,
mcp: Object.keys(tables.mcp).length > 0 ? tables.mcp : mcp,
};
if (routed) return result;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit (comment accuracy): the ff7bd08 message and the reply on the old thread say a user target named agentcore still stops the build. That holds only when the target points at another host, as the test's memory.example.com does. A leftover target in the old shape (agentcore, passthrough to the AgentCore host, GATEWAY_IAM_ROLE) gets a gateway route to the host. The rewrite above turns that into a full-host direct route, and this line then returns before the RUNTIME_ROUTE_NAME_TAKEN check. So build passes with only the "signs every API" warning. The old target, the box-memory-policy.json listing, and the file all stay. Since Box isn't launched, that's fine, but please correct the commit message or reply, or add a line to the local testing guide saying to recreate older Box projects.

// A host whose route the Runtime profile sends directly, not to its target, takes no target: the
// agent's Memory calls go to the AgentCore host directly (runtimeProfile/rules/additions.ts).
const routed = gatewayRoutedTargets(network.runtimeProfile);
const direct = served.filter((host) => routed !== undefined && !routed.has(host.target));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: this treats every managed target that no backend in the derived Runtime profile references as "direct" and removes it, with the message that the box sends those calls directly. Today the only cause is the Memory rewrite. But any future rule that drops or renames a route would also delete its target, with a misleading message. Could direct also require that the host is the AgentCore host (agentCoreDataPlaneHost(network.region))? Or could the additions rule report which targets it took off the gateway? Either would keep this tied to the Memory case.

…ries on the AgentCore host

On AgentCore Runtime the box of a runtime with its default Memory now reaches
the AgentCore data-plane host only for Memory. Code Interpreter, Browser,
identity, and API key calls on that host are blocked inside the box.

- Build writes agentcore-memory-paths.dw beside the Runtime profile and lists
  it last in `policies`. Its first rule denies each request to the host whose
  path is not /memories or under it. Its second denies a path that could
  leave /memories once AWS normalizes it: a `..` or `.` segment, an encoded
  dot, or an encoded backslash. No Memory, actor, session, or record ID holds
  a dot or a backslash.
- A route or HTTP MCP server of the profile to the AgentCore host, and a
  permit that names it, now stop build with RUNTIME_AGENTCORE_HOST_ROUTED.
  Box refuses a gateway route for a host that has another route, and a route
  of its own would reach the other APIs of the host. The problem names the
  entry or the permit of the local profile. Build no longer sends such a
  route to the host directly.
- A user policy file of the same name stops build.

The profile header names the policy file only when the profile lists it.
Box decodes %2e once before the policy, so a double-encoded %252e reaches the
policy as %2e and passes it. No Memory, actor, session, or record ID holds a
%, so the dot-segment rule now also blocks %25 on the AgentCore host.

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-review at 84e0efa, after my COMMENT at ff7bd08. I reviewed the two new commits, git diff ff7bd08b..84e0efae (48d495e and 84e0efa). There was no force-push, and ff7bd08 is still an ancestor of the head.

My earlier notes

  • Blocking, credentialed route to the AgentCore host loses its key (additions.ts:279): addressed. 48d495e removes the rewrite. For a runtime with its default Memory, any [egress] entry, HTTP [mcp] server, or permit that reaches the AgentCore host now stops build with RUNTIME_AGENTCORE_HOST_ROUTED. The problem names the local entry or The permit "<id>". An env:// bearer key on such a route can no longer be swapped silently for aws://. This is the "fail the build" option I suggested. It's covered by unit tests (gateway-backed, direct, and MCP entries; :443, other case, and wildcard; the permit label) and by a build test that checks agentcore.json is left untouched.
  • ff7bd08 commit message on a user agentcore target: moot. Now that the rewrite is gone, a leftover old-shape agentcore target to the AgentCore host does stop build, through RUNTIME_AGENTCORE_HOST_ROUTED. A target of that name for another host still gets RUNTIME_ROUTE_NAME_TAKEN.
  • gatewayRoutedTargets coupling: still open, and now mostly dead code. See the inline comment.
  • China signing inference: still open. Fine for a later phase.

What's new

  • agentcore-memory-paths.dw is written next to the Runtime profile and listed last in policies. Its rules deny every path on the host except /memories and /memories/*, plus .. and . segments, %2e, %5c, and %25. Tests check that it parses, that it uses the regional and China host, and that a set of allowed and blocked paths behave as intended. That last test uses a local regex version of like, so it checks what the rules are meant to do, not how box evaluates them. Your container testing with box 0.1.11-preview.10 covers the gap, and HTTP/2 is noted as not tested. The build test checks the file text and the policies order. The created-template golden tests now expect the policy entry.
  • The header names the policy file only when the profile lists it, and both cases are tested.
  • A user policy file with that name stops build, and that's tested.

Non-blocking (inline): the stale comment and dead branch in boxNetworkWriters.ts. The endsWith name check and the reuse of RUNTIME_ROUTE_NAME_TAKEN for a policy file.

FYI, product impact. For a runtime with a default Memory, the box can no longer reach Code Interpreter, Browser, or another AgentCore Runtime on the data-plane host. That's true even through the gateway, and even when the profile routes the host. A broad *.amazonaws.com route also stops build now. The README says this, and I understand it came from a design review. It might be worth listing under "Breaking change" in the PR template, or noting it for the v1.x merge. @tejaskash's CHANGES_REQUESTED (PRIVATE_VPC endpoint dependency) is still open on the PR.

Other checks: one new problem code, RUNTIME_AGENTCORE_HOST_ROUTED, documented in types.ts. No other new types. No account IDs or internal links in the diff. The branch merges into box-integration without conflicts and isn't behind it. FYI only: it conflicts with #2877 at 9180136 (boxNetwork/network.ts, boxNetworkWriters.ts, manager.boxNetwork.test.ts, shortcuts.ts, two test files) and with #2887 at fa87fb5 (boxNetwork/network.test.ts, boxNetworkWriters.ts, runtimeProfile/types.ts).

CI at review time: verify (Linux, Windows, macOS) and Analyze were still pending for 84e0efa, and e2e was skipped. I didn't wait for them. Please merge only after they're green. A macOS 5000ms screen-test timeout and the Windows transactionSearch EFAULT are known flakes.

Approving. The blocker is fixed with tests, and what's left is non-blocking.

const sent = served.filter((host) => undeclaredKey(spec, host) === undefined);
const unsent = served.filter((host) => undeclaredKey(spec, host) !== undefined);
// A host whose route the Runtime profile sends directly, not to its target, takes no target: the
// agent's Memory calls go to the AgentCore host directly (runtimeProfile/rules/additions.ts).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit (comment accuracy and dead code): since 48d495e the additions rule no longer moves a route off the gateway. A route to the AgentCore host now stops build. So in a build that succeeds, direct should always be empty, and this comment ("the agent's Memory calls go to the AgentCore host directly") describes behaviour that no rule produces any more. My earlier coupling note still applies: if a future rule drops or renames a route, this code would quietly delete its managed target, with the message that the box sends those calls directly. Could c411bae's direct branch (and gatewayRoutedTargets) be removed now? Or, if you want to keep it, tie it to agentCoreDataPlaneHost(network.region).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Moot now: 5732c3c moves routes off the gateway again, so the direct branch is live. The coupling nit still stands, non-blocking: tie direct to agentCoreDataPlaneHost(network.region) so a future rule that drops a route cannot delete its target with this message.

});
}
const userPolicies = (policies ?? []) as unknown[];
if (userPolicies.some((file) => typeof file === "string" && file.endsWith(MEMORY_POLICY_FILE))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: endsWith(MEMORY_POLICY_FILE) also matches a user file such as my-agentcore-memory-paths.dw. Checking that the name is exact, or that it ends in /agentcore-memory-paths.dw, would avoid that. Also, this reuses RUNTIME_ROUTE_NAME_TAKEN for a policy file, but the doc comment on that code in types.ts still says "A route of the user under the name of a route...". Either widen that doc comment or give the policy case its own code.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Moot: 5732c3c removes agentcore-memory-paths.dw and this check.

…-direct-access

# Conflicts:
#	docs/box-local-testing.md
#	src/core/project/manager.tsx
#	src/handlers/project/shortcuts.ts
… with no path limit

Box chooses where a connection goes from its host and port alone, before it
sees the path, so it cannot send /memories directly and Code Interpreter or
Browser through the Box gateway on one host. Code Interpreter, Browser, and
the other AgentCore primitives are egress destinations on the same host as
Memory, so for a runtime with its default Memory they all go to that host
directly, signed with the execution role.

- [egress.agentcore] now names the whole AgentCore data-plane host, not only
  /memories.
- Build no longer writes agentcore-memory-paths.dw or lists it in policies.
- A route or HTTP MCP server of the profile to the AgentCore host no longer
  stops build. It goes to the host directly, signed with a bare aws://, with
  its name and other keys, and build adds no second route beside it.

What the execution role may call on that host depends on its grants. The
README and the profile header say that these calls go to the host directly.

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-review at 967e82f, after my APPROVE at 84e0efa. 84e0efa is still an ancestor (no force-push). Since then: a merge of box-integration (8f83fee, which brought in #2886 and #2878), then 5732c3c, 3c9ac03 and 967e82f. I reviewed git diff 8f83fee2..967e82f3 for the PR's own changes.

5732c3c reverses the design again. [egress.agentcore] now names the whole AgentCore host, agentcore-memory-paths.dw is gone, and any route or HTTP MCP server of the profile to that host is rewritten to go direct with a bare aws://. I'm changing my approval to request changes. That rewrite brings back the blocker I raised at ff7bd08, and it now gives no warning at all. Details are inline.

My earlier notes

  • Blocking at ff7bd08, credentialed route to the AgentCore host loses its key: regressed. At 84e0efa this was fixed by stopping build. 5732c3c removes RUNTIME_AGENTCORE_HOST_ROUTED and drops secret again. I ran a build probe: an [mcp.tools] HTTP server to bedrock-agentcore.us-west-2.amazonaws.com with secret.ref = "env://TOOLS_TOKEN" builds with warnings: []. The Runtime [mcp.tools] gets secret = aws://, no egress- target is written, and build still adds API key credential tools to agentcore.json and writes AGENTCORE_CREDENTIAL_TOOLS to .env.local. The token is never sent, and the user gets no hint why.
  • direct branch in boxNetworkWriters.ts is dead code: moot. It is live again, because the rewrite once more moves routes off the gateway. My coupling nit (tie direct to agentCoreDataPlaneHost(network.region)) still applies but is non-blocking.
  • endsWith(MEMORY_POLICY_FILE) and the reuse of RUNTIME_ROUTE_NAME_TAKEN for a policy file: moot. The policy file is gone.
  • China signing inference: still open, fine for a later phase.

New findings

  1. Blocking (security): with the path policy gone, code in the box can sign AgentCore Identity calls with the execution role. This is the concern in the open thread on additions.ts:298. The reply there says the reach is "bounded by the execution role's grants", but the risky case is the normal one. The strands-box template routes [egress.github] with env://GITHUB_TOKEN, so build adds an API key credential. Per the L3 code cited in that thread (AgentCoreRuntime.ts:471-498; I can't open that repo to check), the execution role then gets GetWorkloadAccessToken* and GetApiKeyCredential. So code in the box can call /identities/... on the now fully signed host and read the GitHub token that box exists to keep away from it. At 78801c2 your container test showed these calls left the box unsigned and got a 403. The design reason for dropping the allowlist (Code Interpreter and Browser must work) doesn't require opening /identities. You've already confirmed that box can deny by path in http:request and that it normalises ., .. and %2e first. So a denylist policy keeps Code Interpreter, Browser and Memory working and closes this gap: forbid on /identities and /identities/* for the AgentCore host, plus the dot-segment and %25 rule from 84e0efa. The other option is for the L3 to skip grantCredentialAccess() for a boxed runtime. If neither lands here, please get an explicit sign-off on the open thread and record it for the v1.x merge.
  2. Blocking: the env:// / API key case above (inline on additions.ts:273).
  3. Blocking: conflicts with box-integration again. A trial merge conflicts in src/core/project/runtimeProfile/rules/additions.test.ts against #2899 (6d009cf, IMDS forbid in every box profile). GitHub shows the PR as CONFLICTING. When you resolve it, please check that #2899's forbid policy still sits in the Runtime policies with this PR's changes.
  4. nit: the profile header can name a route that isn't in the profile (inline on additions.ts:166).

Other comments

  • The open thread on PRIVATE_VPC is now tied to aws/agentcore-l3-cdk-constructs#481. The README says the private VPC endpoint is one "which only the runtime's role may call through". On #481 I noted that its endpoint policy allows bedrock-agentcore:* on * with no account condition. If #481 keeps that, the README claim holds for the principal but not for the resource. Please keep the two in line once #481 settles.
  • The CHANGES_REQUESTED review from tejaskash is still open. Two of its three points are now answered by design (the full host, no build stop). The third, about credential reach, is finding 1 above.
  • The plan lists "direct memory access for the agent" as an open bug with no phase, so no later PR picks up the path policy.

Checklist: test coverage for the rewrite is good (rule test for egress and MCP, :443, case and wildcard, a build test with a second build), but no test has a credentialed entry. No new types; RUNTIME_AGENTCORE_HOST_ROUTED is removed cleanly from types.ts. The README and local testing guide match the new behaviour, apart from the endpoint-policy note above. No account IDs or internal links in the diff.

Local results at 967e82f: bun run typecheck passes. bun test: 6099 pass, 7 skip, 0 fail (6106 tests, 354 files). I did not run the e2e tests. GitHub CI shows conflicts, so CI for this head may be incomplete.

if (!isTable(entry) || !hasDestination(entry.destinations, host)) continue;
routed = true;
const { backends: _backends, secret: _secret, ...kept } = entry;
tables[kind][name] = { ...kept, secret: { ref: RUNTIME_AWS_SIGNER } };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Blocking: this drops the entry's secret and backends whatever they were, so a credentialed route to the AgentCore host silently loses its key. This is the same case I raised at ff7bd08, which 48d495e fixed by stopping build. I checked it with a build probe: [mcp.tools], type = "http", destinations = ["bedrock-agentcore.us-west-2.amazonaws.com"], secret.ref = "env://TOOLS_TOKEN" (for example, an MCP server on another AgentCore Runtime with bearer/JWT inbound auth). Build passes with warnings: []. The Runtime entry becomes secret = { ref = "aws://" }, no gateway target is written, yet the API key credential tools is still added to agentcore.json and AGENTCORE_CREDENTIAL_TOOLS is still written to .env.local. On the Runtime the server gets SigV4 instead of its bearer token and refuses the call.

Could the rewrite apply only when the entry's secret is absent or aws://...? For an env:// secret (or a target with outboundAuth.kind === "apiKey"), stop build with a problem that names the entry and says the host goes direct with the execution role. A rule test and a build test with an env:// MCP server would cover it. That would also stop build from provisioning a credential nobody sends.

"build its requests. They authenticate nothing: box signs each request with the execution " +
"role. Every AWS route goes to the Box gateway" +
(hasDefaultMemory(context.spec, context.runtime)
? `, except each route to ${agentCoreDataPlaneHost(context.region)}, such as ` +

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit (comment accuracy): this checks only hasDefaultMemory, not the profile. When a user route to the host exists, memoryRoutes adds no [egress.agentcore], but the header still says "such as [egress.agentcore]". Could it name the routes that actually reach the host, or drop the "such as" part when agentcore isn't in profile.egress?

This branch has not been deployed

No deployments
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.

4 participants