Feat/pii redaction#2955
Closed
slice-ravichopra wants to merge 6 commits into
Closed
Conversation
Add src/core/redact.rs: emails, Indian mobile/generic phones, PAN, Aadhaar (Verhoeff-gated), card numbers (Luhn-gated), and secrets (AWS keys, JWTs, bearer tokens, PEM blocks, key=value assignments) are masked as [REDACTED:<category>] before any output is emitted. Redaction happens where raw process output is first captured — exec_capture/exec_capture_stdin, run_streaming line loops, run_fallback, pipe mode, and a new line-buffered redacting_copy for rtk proxy — so filters, tee recovery, tracking and the never_worse guard only ever see clean text. ON by default; disable via [redaction] enabled=false in ~/.config/rtk/config.toml or the global --no-redact flag. Supports per-category toggles, [[redaction.custom]] patterns and a line allowlist. RegexSet precheck keeps clean lines zero-allocation.
- tests/redact_proxy_test.rs: proxy stdout/stderr, --no-redact,
8KiB chunk-boundary split, EOF partial line, pipe mode, and a
never_worse interaction test proving redaction cannot be
optimized away by the token guard
- tests/fixtures/redact_mixed_pii_{raw,expected}.txt golden pair
- docs/redaction.md + README: config reference and known gaps
Found during E2E verification against real CloudTrail output: - AccessKeyId ASIA… (STS temporary keys) passed through — AWS key pattern now matches both AKIA and ASIA prefixes - sourceIPAddress leaked caller public/VPC IPs — new `ip` category masks octet-validated IPv4 as [REDACTED:ip]; loopback 127.* and 0.0.0.0 stay visible (dev-server noise, no PII value)
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
cargo fmt --all && cargo clippy --all-targets && cargo testrtk <command>output inspected