fix: add SHA-256 hash chain to audit log ring buffer for tamper-evidence (PILOT-303)#26
fix: add SHA-256 hash chain to audit log ring buffer for tamper-evidence (PILOT-303)#26matthew-pilot wants to merge 1 commit into
Conversation
…nce (PILOT-303) Each audit Entry now carries PrevHash (digest of the preceding entry) and Hash (digest of this entry, encompassing PrevHash and all payload fields). The hash chain is maintained by Append() and rebuilt on RestoreLog() when restoring from a snapshot that predates the chain. VerifyIntegrity() walks the chain to detect tampering. Deterministic binary serialisation avoids JSON field-ordering ambiguities across versions.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
🦫 Matthew PR Check — #26 PILOT-303Status
VerdictCLEAN — all CI green, MERGEABLE. Single-file change to audit/audit.go adding SHA-256 hash chain integrity to the ring buffer.
|
🦫 Matthew Explains — #26 PILOT-303What this doesAdds a cryptographic SHA-256 hash chain to the audit log ring buffer. Each
The chain is maintained by WhyThe ring buffer was plain structs — no cryptographic integrity. An attacker with memory access (debugger, ptrace, JTAG) could drop or rewrite entries without detection. The hash chain makes any single-entry modification computationally evident. Scope
|
📊 PR Status — #26 PILOT-303
CI Checks (2/2 passing)
Canary🧪 Running — dispatched run JiraPILOT-303 — QA/IN-REVIEW (assigned: Teodor Calin). Updated: 2026-05-30T21:51 EEST. Last operator activityPR created by matthew-pilot at 18:51 UTC. No operator activity yet. |
🔍 PR Explanation — #26 PILOT-303What this doesAdds a SHA-256 hash chain to the audit log ring buffer, making it tamper-evident. Each audit entry is cryptographically linked to its predecessor so that any modification, deletion, or reordering of the ring buffer is detectable. The problemThe existing Walkthrough:
|
🤖 PR Status CheckPR #26: fix: add SHA-256 hash chain to audit log ring buffer for tamper-evidence (PILOT-303) matthew-pr-worker • 2026-05-31T11:58:00Z |
🤖 PR Explanationfix: add SHA-256 hash chain to audit log ring buffer for tamper-evidence (PILOT-303) SummaryWhatAdds a cryptographic hash chain to the audit log ring buffer in Each Entry now carries two new fields:
The chain is maintained by Changes+98/−1 lines across 1 file(s):
Files Changed
matthew-pr-worker • 2026-05-31T11:58:00Z |
What
Adds a cryptographic hash chain to the audit log ring buffer in
audit/audit.go.Each Entry now carries two new fields:
PrevHash— SHA-256 hex digest of the preceding entry (empty for genesis)Hash— SHA-256 hex digest of this entry, encompassing PrevHash + all payload fieldsThe chain is maintained by
Append()on every write and rebuilt byRestoreLog()when restoring from a pre-chain snapshot.VerifyIntegrity()walks the chain and returns the index of the first tampered entry (or -1 when intact).Why
The ring buffer was plain structs with no cryptographic integrity. An attacker with memory access (debugger, ptrace, JTAG) could drop or rewrite entries undetectably. The hash chain makes tampering computationally evident — any single-entry modification breaks the chain and is caught by
VerifyIntegrity().Scope
Ticket
PILOT-303