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

1 participant