Skip to content
PatchArc

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

Status in 0.2.0

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 idDetects
aws_access_keyAKIA / ASIA access key ids
aws_secret_access_key40-character secrets near an AWS secret context word
github_patghp_ tokens
github_fine_grainedgithub_pat_ tokens
github_oauthgho_ tokens
slack_tokenxoxa, xoxb, xoxp, xoxr, xoxs tokens
private_key_pem-----BEGIN … PRIVATE KEY----- blocks (RSA, EC, DSA, OpenSSH, PGP)
bearer_jwtThree-segment JWTs starting eyJ
stripe_livesk_live_ keys
openai_api_keyLegacy sk-…T3BlbkFJ… keys
anthropic_api_keysk-ant- keys
google_api_keyAIza keys
connection_stringpostgres://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, every KEY=value line becomes KEY=[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 as user_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

  1. patcharc inspect the capsule, then read the patches: unzip -p capsule.parc 'evidence/git/diffs/*' | less.
  2. Keep secrets out of commits in the first place (.gitignore, pre-commit scanners).
  3. Prefer capability or public links 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.