Redaction
Hansard redaction changes normalized text only. It does not redact raw provider backups, the optional reveal cache, binary attachments, or captured artifacts. It is pattern matching rather than semantic review, so unmatched secrets, identifiers, paths, and unrelated content can remain.
Default behavior
Section titled “Default behavior”hansard init enables the built-in rules for new interactive setups unless
--no-redaction is used. Outside that setup flow, redaction remains disabled
until a configuration is created with hansard redact init.
Check the current state before importing sensitive history:
hansard redact statusThe built-in detectors cover:
- AWS access key IDs;
- Anthropic and OpenAI API keys;
- GitHub and Slack tokens;
- JSON Web Tokens;
- PEM private keys; and
- high-entropy values assigned to environment-variable names containing words
such as
KEY,TOKEN,SECRET, orPASSWORD.
The rule names accepted by the CLI are aws_key, anthropic_key,
openai_key, github_token, slack_token, jwt, private_key, and
high_entropy_env.
Configure and preview rules
Section titled “Configure and preview rules”-
Create or enable the configuration.
Terminal window hansard redact initThe configuration is written to
~/.hansard/redaction.yamlunlessHANSARD_HOMEpoints elsewhere. -
Preview a synthetic sample without changing the archive.
Terminal window hansard redact test --text 'DEMO_SERVICE_TOKEN=0123456789abcdefghijklmnopqrstuvwxyzABCDEF'Preview still works when global redaction is disabled; the output makes that state explicit. Samples in preview output are masked.
-
Preview a file or one archived session when needed.
Terminal window hansard redact test --file ./synthetic-session.txthansard redact test --session SESSION_ID -
Import or reimport after the preview matches the intended boundary.
Customize redaction.yaml
Section titled “Customize redaction.yaml”The configuration supports individual built-ins, exact environment values, custom regular expressions, and repository allowlisting:
enabled: true
built_ins: jwt: false
env_vars: - DEMO_SERVICE_TOKEN
patterns: - name: synthetic_ticket regex: 'DEMO-[0-9]{4}'
allowlist_repos: []Names under env_vars tell Hansard to read the corresponding value from the
environment or a relevant .env file and replace that exact value in
normalized text. The secret value is not written into redaction.yaml.
Custom regular expressions run after the built-ins. Test them against synthetic input before importing a large archive.
Toggle redaction
Section titled “Toggle redaction”Enable or disable the whole subsystem:
hansard redact enablehansard redact disableToggle one built-in while leaving the subsystem enabled:
hansard redact disable jwthansard redact enable jwtRun hansard redact status after editing the YAML or changing a toggle.
Reapply rules to existing sessions
Section titled “Reapply rules to existing sessions”hansard redact reapplyReapply is best-effort. It rewrites a writable local session only when Hansard has the unredacted reveal-cache copy needed to reconstruct its normalized records. Received read-only sessions, scoped web archives, and sessions without that cache are skipped and included in the reported skipped count.
Reapply does not modify:
- byte-preserved raw sources;
- attachment or artifact bytes;
- copies already uploaded to a remote destination;
- messages already posted to Slack; or
- provider-side originals and retention copies.
If source history still exists and parser behavior also changed, a clean provider reimport may be the more reliable recovery path.