Skip to content

fix(runtime): allowlist the A2A protocol headers on A2A runtimes - #2982

Open
waitasecant wants to merge 1 commit into
aws:v1.xfrom
waitasecant:fix/a2a-request-header-allowlist
Open

waitasecant wants to merge 1 commit into
aws:v1.xfrom
waitasecant:fix/a2a-request-header-allowlist

Conversation

@waitasecant

@waitasecant waitasecant commented Dec 1, 2026 •

Copy link
Copy Markdown

Description

For an A2A runtime, the CLI now adds the A2A protocol request headers (A2A-Version and A2A-Extensions) to the runtime's requestHeaderAllowlist. AgentCore Runtime forwards only allowlisted request headers to the container, so before this change an A2A server created by the CLI never received them.

  • withProtocolRequestHeaders(protocol, allowlist) in src/projectSchemas/runtime.ts returns the allowlist with the A2A headers added when the protocol is A2A. Matching is case-insensitive, headers the user passed (--request-header-allowlist) are kept as written and come first, and other protocols are returned unchanged.
  • It is applied where A2A spec entries are built: buildDocsRuntimeSpec (agentcore add runtime, flag handler and wizard) and the a2a-python-strands template resolver (also used by a2a-python-strands-box).
  • The A2A section of the Python and TypeScript runtime docs templates now says the CLI allowlists these headers.

No CDK or CloudFormation change is needed: the pinned @aws/agentcore-cdk@1.5.0 already maps requestHeaderAllowlist to the runtime's requestHeaderConfiguration.allowlistedHeaders.

Related Issue

Closes #2981

Documentation PR

Documentation is included here (runtime docs templates). command.md is not changed.

Type of Change

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

Testing

How have you tested the change?

  • Unit tests: a helper test (A2A, user headers kept, case-insensitive dedupe, other protocols unchanged, defaults pass the header-name check), a flag-handler test (add runtime --protocol A2A and --protocol MCP with --request-header-allowlist), and a template test table (a2a-python-strands with and without user headers, agent-python-strands, mcp-python-fastmcp). The existing "typescript A2A" and "docs-only runtimes" expectations and the A2A manifest snapshot now include the allowlist (the snapshot diff is exactly the 4 added lines).

  • Ran the real CLI from source on a scratch project: create --template a2a-python-strands and add runtime --protocol A2A write ["A2A-Version","A2A-Extensions"]; with --request-header-allowlist X-Tenant a2a-version the result is ["X-Tenant","a2a-version","A2A-Extensions"]; an HTTP runtime has no allowlist.

  • Deployed with agentcore deploy (this branch, us-west-2) a project from agentcore create --template a2a-python-strands, and invoked it through InvokeAgentRuntime with A2A-Version and A2A-Extensions headers. With the allowlist this branch writes, the runtime's requestHeaderConfiguration is requestHeaderAllowlist: [A2A-Version, A2A-Extensions] and the container received both headers. With the allowlist removed from agentcore.json (what the CLI wrote before), the runtime has no header configuration and the container received none. Details are in A2A runtimes are created without the A2A-Version / A2A-Extensions request headers allowlisted #2981. The scratch stack was deleted afterwards. I did not run the e2e suite (bun run test:e2e).

  • I ran bun test: 7207 pass, 5 fail. The 5 failures are Windows-only and also fail on an unmodified v1.x (src/io/source.test.ts stdin test, symlink tests in boxNetworkSource.test.ts, migrate/workspace.test.ts and runtimeBuild.test.ts).

  • I ran the relevant end-to-end tests with bun run test:e2e, or explained why they are not applicable (not run; I deployed and checked a project by hand instead, see above)

  • I ran bun run typecheck

  • I ran bun run lint:check

  • I ran bun run format:check

  • I ran bun run audit: it reports 4 vulnerabilities (cross-spawn, react-router), unrelated to this change; no dependency files changed

  • I ran bun run secrets:check

  • I ran bun run build

  • If I modified src/assets/, I updated affected snapshots with bun test <test-file> --update-snapshots and committed them

  • If I re-recorded fixtures or golden files, every change beyond account identifiers is explained by this PR (none re-recorded)

  • This PR does not change command.md (the release workflow regenerates it)

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published (none needed)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

AgentCore Runtime only forwards request headers that are in the runtime's
requestHeaderAllowlist, so an A2A server never received A2A-Version or
A2A-Extensions. When the protocol is A2A, add both headers to the allowlist
in `add runtime` and in the A2A Strands template (case-insensitive, headers
the user passed are kept, other protocols are unchanged).

Closes aws#2981

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A2A runtimes are created without the A2A-Version / A2A-Extensions request headers allowlisted

1 participant