Skip to content

Feat/pii redaction#2955

Closed
slice-ravichopra wants to merge 6 commits into
rtk-ai:developfrom
slice-ravichopra:feat/pii-redaction
Closed

Feat/pii redaction#2955
slice-ravichopra wants to merge 6 commits into
rtk-ai:developfrom
slice-ravichopra:feat/pii-redaction

Conversation

@slice-ravichopra

Copy link
Copy Markdown

Summary

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk <command> output inspected

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

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)
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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