The terminal scrolls fast. Logs stream like water from a broken dam. One line contains an email. The next a phone number. The third a credit card. You can't blink. If you do, sensitive data slips through and lands in places it shouldn’t.
Real-time PII masking in Zsh is the fix. No waiting for post-processing. No exporting to an external tool. The data is neutralized the instant it appears. It doesn’t matter if it comes from curl, grep, or a live script output. The masking happens on the wire, inside your shell session, before the bytes reach the screen or a file.
The core is simple: intercept stdout and stderr in Zsh, pass them through a masking function, then print the cleaned output. With regex tuned to match common PII — emails, IPv4 addresses, phone numbers, SSN formats — you can replace matches with tokens, hashes, or [REDACTED]. Set it as a preexec hook so every command routes its live output through the filter. The stream is sanitized without breaking or delaying execution.