Skip to content

fix(debug): redact sensitive response headers - #32

Open
fallintoplace wants to merge 2 commits into
openai:mainfrom
fallintoplace:fix/redact-response-headers
Open

fix(debug): redact sensitive response headers#32
fallintoplace wants to merge 2 commits into
openai:mainfrom
fallintoplace:fix/redact-response-headers

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 16, 2026

Copy link
Copy Markdown

Problem

Debug logging already clones and redacts request headers, but response headers were passed directly to httputil.DumpResponse. This exposed values such as Set-Cookie, response-side Authorization, and API-key headers whenever debug logging was enabled.

Fix

  • share one case-insensitive header redaction path across requests and responses
  • redact direct and proxy authorization while retaining only the authentication scheme
  • shallow-copy the response before logging so the response returned to callers is untouched
  • keep ordinary response headers available for debugging

Coverage

The response test covers multiple cookies, direct and proxy authorization, an API-key header, deliberately non-canonical casing, a visible request ID, and both header and response-object identity.

Validation

  • ./scripts/test
  • go test -race ./internal/debugmiddleware -count=1
  • go vet ./...
  • ./scripts/lint

@fallintoplace
fallintoplace requested a review from a team as a code owner July 16, 2026 13:11
@fallintoplace fallintoplace changed the title fix: redact sensitive response headers in debug logs fix(debug): redact sensitive response headers Jul 16, 2026
@markstuart-oai

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-06T01:31:37.296580Z 5318021 Manual request
🔒 Security Review Completed 2026-09-06T01:32:22.988870Z 5318021 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 5318021418

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 5318021418

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

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