Originally created by: lodar
audit_log (src/lib/audit.sh) redacted exactly five --flag=value forms —
--api-key=, --telegram-token=, --discord-token=, --code=, --token= — and wrote every
other argument verbatim. A secret passed as a positional key=value pair matched none of them:
5dive agent config <seat> set telegram.token=<real bot token>
/var/log/5dive/agent-audit.log is 640 root:claude, and group claude contains every agent seat
on this box, so the value was readable by every seat, indefinitely.
Blast radius (re-measured at head, 2026-09-11): 2 bot-token-shaped values in 106,022 lines;
no rotated/older audit logs (single live file). Both are agent config … set telegram.token=…
lines for now-retired seats. No token value was read into this branch, a row, or this PR.
Rotation was handled human-side out-of-band (human:y00212, 2026-09-11 08:24) — this PR is the
write-site fix only.
The defect is the verbatim args capture, not the one subcommand, so the new rule matches on
the key name of any key=value argument — flagged or positional, any case, substring-wide
(*token*, *secret*, *key*, *password*, *passwd*, *credential*) — rather than
enumerating verbs. Fixing only telegram.token would be re-earned by the next verb that takes a
secret as an argument.
--flag= list runs first, verbatim. Nothing that was redacted before stops beingcmd_bug.sh:_bug_redact_argv gets the same rule as a second sed expression. It required a-- too, and that string is bound for a public GitHub issue, so the bar there is atIt is deliberately a wide denylist, and deliberately not a completeness claim: over-redacting
--sort-key=name costs a reader one field, under-redacting a credential costs a rotation. A secret
under a key name carrying none of those words is still recorded — the standing rule remains do not
pass secrets as arguments.
tests/audit_key_value_secret_redaction_unit.sh (new, 8 arms, no root / no network):
telegram.token= redacted, key kept, channels=telegram intact;--flag= forms still redacted (no regression from the rewrite);TELEGRAM.TOKEN=, api_key=,--auth-secret=, db_password=, aws.credential=);assignee=ops, --priority=high, status=todo stay verbatim. A log that<redacted> for everything records nothing;= (token, secret-santa, --keyring) is untouched;_bug_redact_argv mirrors the positional rule;
plus a suite guard proving the run never appended to the live fleet log.
new test on this branch : 8 passed, 0 failed
NEGATIVE CONTROL, origin/main @ fec70af0 (same test file, unfixed tree)
: 4 passed, 4 FAILED (cases 1, 1b, 3, 6)
regression set, all green : audit_nonroot_unit 7/0 · audit_exit_trap_row_unit 8/0
bug_report_pii_allowlist_unit 47/0 · agent_send_audit_unit 18/0
audit_task_store_classification_unit 1/0 · gate_answer_audit_unit 12/0
Every token value in the harness is the reserved fixture shape (1234567890:AAAA…), never a real
credential.
5dive-cli is not auto-deploying, and the installed CLI on this host is 0.31.0, so5dive agent config <seat> set telegram.token=<fake> would exercise the unfixed writer and640 root:claude. Tightening to 600 root:root5dive trace / audit reads — it removes the readers, not theCloses DIVE-4297.
🤖 Generated with Claude Code
Ticket changed by: lodar