Skip to content

fix: add missing secret patterns to redact_sensitive_patterns#3

Merged
SemTiOne merged 1 commit into
mainfrom
fix/issue-2-secret-redaction-patterns
Jul 10, 2026
Merged

fix: add missing secret patterns to redact_sensitive_patterns#3
SemTiOne merged 1 commit into
mainfrom
fix/issue-2-secret-redaction-patterns

Conversation

@SemTiOne

Copy link
Copy Markdown
Owner

Closes #2

Adds type-tagged detection for GitHub PATs, LLM API keys (OpenAI/Anthropic/DeepSeek), AWS access keys, Slack tokens, and URI credentials. Formats that don't rely on a nearby trigger word. Each gets its own tag ([REDACTED:GITHUB_TOKEN], [REDACTED:AWS_KEY], etc.); the 4 existing patterns keep emitting plain [REDACTED], unchanged.

Also extended the trigger-word group with secret_key/private_key/auth_token (covers SECRET_KEY=, PRIVATE_KEY=, AUTH_TOKEN= style names).

Two bugs caught while testing the patterns discussed in the issue:

  • The issue's own repro (token=ghp_XXXX) doesn't actually reproduce the bug. It already matches the existing token= trigger pattern.
  • A naive sk- char class excluding -/_ only redacts the prefix of keys like sk-ant-api03-..., leaving the rest of a live key exposed. Fixed.

Out of scope (deferred, not yet discussed in enough detail to scope safely): -p/--password CLI flags (collides with docker run -p, git log -p), bare key as a trigger word (false-positives on KEY=VALUE), env var assignment, SSH key blocks, entropy heuristics.

12 new regression tests. Full suite: 262 passed, 0 failed. ruff clean.

@SemTiOne
SemTiOne merged commit 154a869 into main Jul 10, 2026
8 checks passed
@SemTiOne
SemTiOne deleted the fix/issue-2-secret-redaction-patterns branch July 10, 2026 06:19
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.

[Security]: commit message redaction in redact_sensitive_patterns() is missing several common secret patterns

1 participant