Skip to content

fix(logging): redact credentials from all log records - #94

Merged
f3rdy merged 1 commit into
masterfrom
fix/redact-auth-headers
Jul 17, 2026
Merged

f3rdy merged 1 commit into
masterfrom
fix/redact-auth-headers

Conversation

@f3rdy

@f3rdy f3rdy commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Credentials must never reach log output. This PR installs a redacting LogRecord factory at CLI startup so Authorization headers, Bearer/token scheme values, GitHub PATs (ghp_*/github_pat_*) and Atlassian API tokens (ATATT*) are masked in every log record — for all loggers and all handlers, including handlers added in the future (no central logging setup exists today, so the factory is the only choke point that covers every path).

Closes #93.

Changes

  • new budjira/utils/redact.py: pattern-based redact() + idempotent, thread-safe install_redaction() via logging.setLogRecordFactory
  • budjira/cli/main.py: install redaction at startup
  • tests/utils/test_redact.py: 13 tests (unit + logging integration; f-string and %-style records; clean records keep their args; idempotent install)

Verification

  • full suite: 865 passed, 3 skipped (pre-existing skips)
  • ruff check + format: clean · mypy: clean · bandit: no findings

https://claude.ai/code/session_01F4MERCpiV1BP2jGYGUVjAU

Install a redacting LogRecord factory at CLI startup so Authorization
headers, Bearer/token scheme values, GitHub PATs (ghp_*/github_pat_*)
and Atlassian API tokens (ATATT*) can never reach log output, present
or future, regardless of handler configuration. Covers f-string and
%-style messages; clean records keep their args untouched.

Claude-Session: https://claude.ai/code/session_01F4MERCpiV1BP2jGYGUVjAU
@f3rdy
f3rdy merged commit b729dc0 into master Jul 17, 2026
5 checks passed
@f3rdy
f3rdy deleted the fix/redact-auth-headers branch July 29, 2026 07:37
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.

Redact Authorization headers in logs and error output

1 participant