← source on GitHub ↗

Secret redaction (layered pipeline)

Layered detection + masking of secret-shaped content in everything that flows through the agent — tool results, the provider context, and user prompts — so secrets never reach the LLM, the transcript, or the session JSONL (issue #24).

Two systems run side by side:

Layers

Priority order (higher wins overlaps): registered (exact values) → path (credential files) → credential (DOM form-field values) → vendor (GitHub/AWS/OpenAI/JWT/…) → prefix (indexOf pre-screen feeding vendor) → pem → asn1 → connection → context (password/secret key names) → entropy → pii (off by default). Output markers are [REDACTED:<kind>], idempotent, and line-count preserving. Allowlisted shapes (Git SHAs, UUIDs) and data: base64 URLs survive.

Config (redact: in ~/.fah/config.yaml or project .fah/config.yaml)

redact:
  enabled: true        # master switch (default true)
  blockMode: false     # ALSO deny read/bash touching credential files
  layers:
    pii: true          # per-layer overrides
    entropy: false
  allowlist:           # regexes whose full match suppress redaction
    - '[0-9a-f]{40}'
  toolAllow: [read]    # hook-level policy: only these tools get redacted
  toolDeny: [write]    # never redacted (wins over toolAllow)

Defaults are never written back to the config file. enabled: false keeps the pipeline unattached entirely.

Semantics

CLI

/redact — status (on/off, blockMode, registered secret count, session match count). Subcommands: on|off, block on|off, stats (matches per layer and per tool), layers (per-layer toggle state).