fix(security): redact invalid Bedrock bearer credentials - #2419
fix(security): redact invalid Bedrock bearer credentials#2419HAYDEN-OAI wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5253a8ce3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Independent two-pass review confirms the existing unresolved malformed-bearer discussion; no duplicate inline comment is needed. P2: Node Headers accepts several forbidden HTTP field-value control bytes, so exception-only sanitization in both Bedrock authentication paths allows malformed bearer credentials to reach the transport instead of rejecting them before fetch. The default Node transport fails without exposing the credential, so a default P1 disclosure claim would overstate the impact; supported custom transports may provide less-safe diagnostics. Explicitly reject forbidden control bytes in both paths while preserving valid horizontal tabs, supported byte values, and existing Unicode handling.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Independent two-pass security review found a Medium credential-integrity gap in the new Bedrock bearer validator: accepted tokens ending in HTTP whitespace are silently changed by native Headers before dispatch.
Castiron custom code
The report setup or validation failed. Inspect the workflow run. |
Summary
TypeErrorsanitization to dependency-free and AWS-backed Bedrock providers and the existingBedrockOpenAIclient.Regression-first proof
The new real-public-client regression produced 37 failing / 12 passing cases before the production change; all 49 cases pass afterward. Coverage spans static and rotating credentials across all three public Bedrock entrypoints, malformed line-feed/carriage-return/CRLF/NUL/Unicode values, default logging, absent causes, unsent requests, caller-header isolation, provider-error identity, and valid authentication.
A focused inline lint exception documents why preserving the original credential-bearing error as
causewould recreate the privacy issue.Verification
publint(only the pre-existing vendor warning) and packed-package Node 22 checks.