Skip to content

feat(koinon): tamper-evident log with BLAKE3 hash chain#6

Merged
forkwright merged 1 commit intomainfrom
p0-05/tamper-log
Mar 12, 2026
Merged

feat(koinon): tamper-evident log with BLAKE3 hash chain#6
forkwright merged 1 commit intomainfrom
p0-05/tamper-log

Conversation

@forkwright
Copy link
Owner

Summary

  • Append-only log writer with BLAKE3 hash chaining for forensic integrity
  • Binary format: 4-byte LE length + CBOR payload + 32-byte BLAKE3 hash
  • LogEntryKind: SignalObserved, EntityCreated, ConfigChanged, AlertRaised, ActionTaken
  • Chain verification: streaming O(n) replay detecting single-byte tampering
  • File rotation with configurable size threshold, sequential numbering (.1.log, .2.log, …)
  • Log recovery on reopen: reads to end to restore prev_hash and sequence
  • 19 tamper_log tests including 4 corruption/tampering detection scenarios

Test plan

  • cargo test --workspace — all 51 tests pass
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --all -- --check — clean
  • Tampering detection: flip single byte in CBOR → Broken at correct sequence
  • Tampering detection: zero last hash → Broken
  • Truncation → Corrupted
  • Rotation: small threshold triggers rename + fresh chain, sequential numbering

🤖 Generated with Claude Code

Append-only log writer with BLAKE3 hash chaining for forensic integrity.
Binary format: 4-byte LE length + CBOR payload + 32-byte BLAKE3 hash.
LogEntryKind variants: SignalObserved, EntityCreated, ConfigChanged,
AlertRaised, ActionTaken. Streaming O(n) chain verification detects
single-byte tampering. File rotation with configurable size threshold
and sequential numbering. Log recovery on reopen reads to end to
restore prev_hash and sequence. 19 tamper_log tests including 4
corruption/tampering detection scenarios.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

⚠️ Large PR detected — 5 files, 1230 lines changed.

Consider splitting into smaller PRs for easier review. Not a blocker, just a signal.

@forkwright forkwright merged commit 23fc071 into main Mar 12, 2026
10 checks passed
@forkwright forkwright deleted the p0-05/tamper-log branch March 13, 2026 14:05
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