You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(audit): redact secret-named env-assignment prefixes before logging (ob-y5ep) (#191)
The audit logger wrote command lines through `scanner.redact()`, which only
masked substrings matching a known secret *pattern*. A command run as
`RAFTER_API_KEY=<value> rafter ...` logged the value in plaintext: the key's
shape matches no built-in pattern, so `redact()` left it untouched — leaking
real API keys into `~/.rafter/audit.jsonl` despite `redact_secrets: true`.
Add env-assignment redaction to the shared redaction path
(`PatternEngine.redactText` / `redact_text`), so every `scanner.redact(command)`
call site benefits (both `logCommandIntercepted` and `logPolicyOverride`). Any
`NAME=VALUE` token whose NAME looks secret-bearing
(`/(?:^|_)(KEY|TOKEN|SECRET|SECRETS|PASSWORD|PASSWD|PWD|API[_-]?KEY|ACCESS[_-]?KEY|CREDENTIALS?|AUTH)$/i`,
which includes RAFTER_API_KEY) has its VALUE masked with the codebase's existing
char-mask. This is additive to the existing pattern-based redaction — it catches
values that match no pattern but sit behind a secret-named env var. Benign
assignments like `FOO=bar` and `NODE_ENV=production` are left untouched.
Both implementations updated in lockstep (identical regex, ordering, and mask).
Tests added in both suites: a `RAFTER_API_KEY=<val> rafter scan .` command must
not leak the raw value into the log, and benign assignments must be preserved.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments