Skip to content

fix(audit): detect tail-truncation of the Merkle audit chain - #1287

Open
tech4biz-yasha wants to merge 1 commit into
RightNow-AI:mainfrom
tech4biz-yasha:fix/audit-truncation-detection
Open

tech4biz-yasha wants to merge 1 commit into
RightNow-AI:mainfrom
tech4biz-yasha:fix/audit-truncation-detection

Conversation

@tech4biz-yasha

Copy link
Copy Markdown

Summary

The forward-only walk in verify_integrity() cannot detect entries deleted from the end of the persisted chain, because the surviving links all remain valid. A truncated audit log therefore passes verification.

Changes

  • Persist the chain tip hash to a single-row audit_chain_state table on every write
  • Add verify_against_stored_tip() and compare the stored tip against the recomputed head on load
  • Add a regression test (audit::tests::test_audit_truncation_is_detected)

Testing

  • clippy clean on the changed file (audit.rs); workspace clippy has pre-existing failures on the current toolchain, unrelated to this change
  • cargo test --workspace passes
  • Live integration tested (if applicable)

Security

  • No new unsafe code
  • No secrets or API keys in diff

Disclosure

Reported privately by email per SECURITY.md on 6 September 2026. No response received, so opening publicly. This is a tamper-detection gap rather than an exploitable flaw.

The forward-only walk in verify_integrity() cannot detect entries
deleted from the end of the persisted chain, since surviving links
remain valid. Persist the tip hash to a single-row audit_chain_state
table on every write and compare it on load via a new
verify_against_stored_tip() method. Adds a regression test.
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