Skip to content

Optional keyed (HMAC) audit log chain - #11

Merged
deadp merged 2 commits into
mainfrom
queue/q659
Oct 30, 2026
Merged

deadp merged 2 commits into
mainfrom
queue/q659

Conversation

@deadp

@deadp deadp commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Opt-in per-case audit key (env var or key file): each entry gets an HMAC-SHA256 tag chained to the previous tag, stored in a new audit_mac table. Verify has unkeyed and keyed modes, names the first bad entry, and reports 'keyed, key needed' without the key.
SECURITY.md has Assumptions and Questions for maintainers; README and CHANGELOG updated.
Tests: 14 new keyed tests; the unittest suite passes (1445 run, 14 skipped), and so does tests/smoke.py. I did not run a JS typecheck (Python repo).

Queued from the dashboard (item 659). The request:

SIZE: large

Proposal 50: optional keyed audit log chain, so the log cannot be forged without a key. This PR is written so it can later be offered to the upstream maintainers (switch-nz/strata), who make the design calls. Do not decide for them: implement a sensible default and write every choice down as an assumption they can accept or change.

Goal: Strata's audit log chain is unkeyed, so anyone with write access to the case folder can rebuild a whole forged chain. Add an OPTIONAL per-case key: each entry gets an HMAC-SHA256 over the entry and the previous entry's tag. Read the existing audit log code and its tests first and follow their style. Keep the change small and easy to reshape.

Default choices (each is an assumption, not a decision):

  1. Off by default. A case with no key behaves exactly as today; old unkeyed logs still verify.
  2. The key comes from a key file path or an environment variable named in the docs; never written into the case folder or the log. No passphrase prompt or new UI.
  3. Verify has unkeyed (as today) and keyed modes. A tampered keyed entry fails and the output names the first bad entry. A keyed log verified without the key reports "keyed, key needed", not "ok".
  4. Constant-time tag comparison. Key never logged or put in error messages.
  5. Limits stated plainly: protects against forging without the key, not against a key holder or deleting the whole log.

PR description must have two sections: "Assumptions" (the list above, as built) and "Questio

Opened by the queue runner on LXC 113. Merged once CI checks pass and the reviewer's verdict is recorded, unless it touches a hard line (qrunner/hardlines.toml): then it waits for Joshua's yes on the dashboard.

🤖 Generated with Claude Code

@deadp
deadp merged commit af38e0f into main Oct 30, 2026
33 checks passed
@deadp
deadp deleted the queue/q659 branch October 30, 2026 22:02
deadp added a commit that referenced this pull request Oct 30, 2026
Co-authored-by: Queue runner <queue-runner@noreply.invalid>
deadp added a commit that referenced this pull request Nov 5, 2026
Co-authored-by: Queue runner <queue-runner@noreply.invalid>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant