Skip to content

fix: redact Authorization header in debug request dump#947

Open
aviadshiber wants to merge 1 commit intoankitpokhrel:mainfrom
aviadshiber:fix/redact-auth-headers-in-debug-dump
Open

fix: redact Authorization header in debug request dump#947
aviadshiber wants to merge 1 commit intoankitpokhrel:mainfrom
aviadshiber:fix/redact-auth-headers-in-debug-dump

Conversation

@aviadshiber
Copy link
Copy Markdown

@aviadshiber aviadshiber commented Feb 12, 2026

Summary

  • When --debug mode is enabled, httputil.DumpRequest outputs the full HTTP request including the Authorization header containing Bearer tokens or base64-encoded Basic auth credentials
  • This could lead to credential exposure in CI/CD logs, shared terminal sessions, or bug reports
  • The fix redacts the Authorization header value before dumping (preserving only the scheme like Bearer or Basic), then restores the original header so the request is not modified for callers

Security Impact

Vulnerability: Credential exposure via debug output
Severity: Medium
Affected code: pkg/jira/client.godump() function

Before this fix, enabling --debug would print:

Authorization: Bearer actual-api-token-here

After this fix:

Authorization: Bearer <redacted>

Test plan

  • Added TestDumpRedactsAuthorizationHeader — verifies Bearer token is redacted and original header is restored
  • Added TestDumpRedactsBasicAuthHeader — verifies Basic auth credentials are redacted and original header is restored
  • All existing tests pass (go test ./pkg/jira/...)

🤖 Generated with Kapsis

@aviadshiber aviadshiber force-pushed the fix/redact-auth-headers-in-debug-dump branch 3 times, most recently from f690fd7 to 3179156 Compare February 12, 2026 03:40
When --debug mode is enabled, httputil.DumpRequest outputs the full
HTTP request including the Authorization header, which contains the
API token (Bearer) or base64-encoded credentials (Basic auth). This
could lead to credential exposure in CI/CD logs, shared terminal
sessions, or bug reports.

Clone the request headers before dumping, redact sensitive header
values in the clone, then restore the original headers. This ensures
the debug output never contains credentials while leaving the actual
request object untouched for callers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aviadshiber aviadshiber force-pushed the fix/redact-auth-headers-in-debug-dump branch from 3179156 to 957c36a Compare February 12, 2026 03:45
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