Redaction
The redaction engine that ships with PatchArc, its thirteen detectors and rules, and the honest status of automatic redaction in 0.2.0.
validated against patcharc 0.2.0 · 2026-08-22
The redaction engine exists in the repository (internal/redact) with thirteen built-in detectors, env-file rules, entropy scanning, forbidden paths, and custom regexes, and it is covered by tests. It is not invoked by patcharc stop yet, so capsules contain commit patches as Git produced them. manifest/redaction.json lists your configured rules with an empty "applied" list, and trust.redaction_applied is false. Inspect a capsule before you share it, and treat public ArcLinks as public.
Built-in detectors
| Rule id | Detects |
|---|---|
aws_access_key | AKIA / ASIA access key ids |
aws_secret_access_key | 40-character secrets near an AWS secret context word |
github_pat | ghp_ tokens |
github_fine_grained | github_pat_ tokens |
github_oauth | gho_ tokens |
slack_token | xoxa, xoxb, xoxp, xoxr, xoxs tokens |
private_key_pem | -----BEGIN … PRIVATE KEY----- blocks (RSA, EC, DSA, OpenSSH, PGP) |
bearer_jwt | Three-segment JWTs starting eyJ |
stripe_live | sk_live_ keys |
openai_api_key | Legacy sk-…T3BlbkFJ… keys |
anthropic_api_key | sk-ant- keys |
google_api_key | AIza keys |
connection_string | postgres://user:pass@host and similar (MySQL, MongoDB, Redis, AMQP) |
Matches are replaced with [REDACTED:<rule_id>].
Other rules
env_file: in.env,.envrc, and.env.*files, everyKEY=valueline becomesKEY=[REDACTED:env_value]; comments are kept.high_entropy: runs of 20 or more base64-ish characters containing both letters and digits with Shannon entropy of at least 4.5 bits per character are replaced with[REDACTED:high_entropy].forbidden_paths: files matching these globs have their entire body replaced with a policy notice.email_mask: every email address becomes[REDACTED:email].user_regex: your own Go RE2 patterns, applied asuser_regex_<n>.
Configuration
redact:
rules: [] # empty = all built-in detectors; or list rule ids
forbidden_paths: ["secrets/**", "*.pem"]
email_mask: false
user_regex:
- "INTERNAL-[A-Z0-9]{8}"
The default config written by patcharc init lists six rule ids: aws_access_key, private_key_pem, bearer_jwt, high_entropy, env_file, connection_string. A non-empty list enables only those; an unknown id is an error. To enable every detector, set rules: [].
The report
When the engine runs it produces a report stored as manifest/redaction.json: the rule list, one entry per applied redaction (rule, path, offset, replacement, and hash prefixes of the input and output), skipped files, and policy violations. Reviewers see that material was withheld and where, without seeing what it was.
What to do today
patcharc inspectthe capsule, then read the patches:unzip -p capsule.parc 'evidence/git/diffs/*' | less.- Keep secrets out of commits in the first place (
.gitignore, pre-commit scanners). - Prefer
capabilityorpubliclinks only for capsules you have read.
Automatic redaction at stop is the first item on the 0.3 list; when it ships, trust.redaction_applied becomes true and the report fills in.