Skip to content

feat: expand custom request header forwarding to match runtime allowlist#483

Merged
padmak30 merged 1 commit into
mainfrom
feat/runtime-custom-headers
May 19, 2026
Merged

feat: expand custom request header forwarding to match runtime allowlist#483
padmak30 merged 1 commit into
mainfrom
feat/runtime-custom-headers

Conversation

@padmak30
Copy link
Copy Markdown
Contributor

_build_request_context in BedrockAgentCoreApp, BedrockCallContextBuilder (A2A), and AGUIApp previously only forwarded Authorization and headers prefixed with X-Amzn-Bedrock-AgentCore-Runtime-Custom-, silently dropping any other custom headers (e.g. X-Api-Key, X-Custom-Signature) even after the runtime service was updated to forward them to the container.

Adds RESTRICTED_HEADERS (frozenset) and is_forwardable_header() to models.py implementing the full allowlist rules from the docs: block the restricted header set, x-amz-* (SigV4 reserved), and x-amzn-* (except the legacy AgentCore custom prefix); pass everything else through.

Issue #, if available: #468

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

…list

_build_request_context in BedrockAgentCoreApp, BedrockCallContextBuilder
(A2A), and AGUIApp previously only forwarded Authorization and headers
prefixed with X-Amzn-Bedrock-AgentCore-Runtime-Custom-, silently dropping
any other custom headers (e.g. X-Api-Key, X-Custom-Signature) even after
the runtime service was updated to forward them to the container.

Adds RESTRICTED_HEADERS (frozenset) and is_forwardable_header() to
models.py implementing the full allowlist rules from the docs: block the
restricted header set, x-amz-* (SigV4 reserved), and x-amzn-* (except
the legacy AgentCore custom prefix); pass everything else through.
@github-actions
Copy link
Copy Markdown
Contributor

✅ No Breaking Changes Detected

No public API breaking changes found in this PR.


# Headers that cannot be forwarded to agent code.
# Source: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-header-allowlist.html
RESTRICTED_HEADERS: frozenset[str] = frozenset(
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.

what if this gets out of sync?

@padmak30 padmak30 merged commit 5fde434 into main May 19, 2026
62 of 66 checks passed
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.

2 participants