Skip to content

fix(verify_audit): stop recomputing writer-hashed evidence rows - #92

Merged
fastrevmd-lab merged 3 commits into
mainfrom
fix/evidence-tier-verify-wt
Oct 26, 2026
Merged

fastrevmd-lab merged 3 commits into
mainfrom
fix/evidence-tier-verify-wt

Conversation

@fastrevmd-lab

Copy link
Copy Markdown
Member

Problem. verify_audit reported every tier='evidence' row as content_edit: all 111 rows from 5 writers (prod-labmode-junos, prod-junos2mcp, prod-labmode-proxmox, prod-proxmox2mcp, test-labmode-junos). A check that fails on everything hides a real tamper among the false positives. It also makes scripts/checkpoint_audit.py refuse every evidence chain, so they can't be checkpointed.

Root cause. The two sides hash differently, and the stored row can only ever match one of them:

mecmcp-audit (writer) audit_chain.compute_row_hash (verifier)
Input sorted-key canonical JSON of the full EvidenceRecord prev_hash + "\n" + json([9 fields])
Timestamp nanosecond to_rfc3339() ms …Z
Fields includes kind, outcome, run_id, segment_seq, … 9 stored columns
Output sha256:<hex> hex

Reproduced on a live row: the Rust form hits its stored row_hash exactly, after recovering the 6 sub-millisecond timestamp digits that DateTime64(3) drops. The Python form never can. Chain linkage is intact: 0 of 111 rows have a dangling prev_hash.

Change.

  • _content_recomputable(row) is False for evidence rows. verify_tier step 1 and both bridge paths skip the content recompute for those rows only. Every other tier is still content-checked; a test pins that.
  • Evidence integrity in SSDF rests on linkage, reachability and signed checkpoints. Content integrity rests on the writer's signed segments.
  • The CLI prints content=writer-hashed(not-recomputed) for the evidence tier, so OK doesn't read as "content checked".
  • The docs/audit-evidence-contract-v1.md hash line described a third algorithm; it now describes what the writer actually does. scripts/verify_evidence_contract.py still implements that third algorithm, and is left for a follow-up.

Security trade-off. SSDF can no longer flag a content edit of an evidence row. In practice it never could: every row already failed. Deletions, insertions and forks are still caught.

Why now. The first evidence rows (2026-08-24) reach the 90-day TTL around 2026-11-22. An evidence chain that isn't checkpointed before its genesis expires can never verify again. That has already happened to the sovereign chain.

Tests: 687 passed (4 new). The three evidence tests fail when _content_recomputable is reverted to "always". Ruff and Trivy are clean.

🤖 Generated with Claude Code

fastrevmd-lab and others added 3 commits October 26, 2026 19:20
Every tier='evidence' row failed as content_edit, all 111 of them across
5 writers, so the check was pure noise that would have hidden a real
tamper. mecmcp-audit's row_hash digests the full EvidenceRecord
(sinks/ssdf.rs compute_record_hash): sorted-key canonical JSON that
includes a nanosecond timestamp, kind and outcome, none of which
ssdf.audit stores. No reader can recompute it. Reproduced against a live
row: the Rust form matches its stored hash and the Python form never can.

verify_tier and both bridge paths now skip the content recompute for
evidence rows (_content_recomputable). Evidence integrity in SSDF rests
on linkage, reachability and signed checkpoints, and content integrity
on the writer's signed segments. The CLI prints
content=writer-hashed(not-recomputed) for the tier, so OK does not imply
the content was checked. Every other tier is still content-checked.

This unblocks checkpointing the evidence chains. The 2026-08-24 rows
reach the 90-day TTL around 2026-11-22, after which an unanchored chain
can never verify.

The contract doc's hash line, which described a third algorithm, now
says what the writer does. scripts/verify_evidence_contract.py still
carries that third algorithm; it is out of scope here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ridge opaque rows

Codex review of 6e7c116 (two P1s, both valid):

- tier is mutable stored content, so on its own it switched the content
  check off. Relabelling a sovereign chain as evidence, with a server_id,
  would have verified clean. The exemption now also needs the writer's
  hash shape, sha256:<64 hex>. SSDF's own rows are bare hex, so a relabelled
  row is still recomputed and caught. Live data splits exactly: 111/111
  evidence rows are writer-shaped and 0/10 others are.
- A writer-hashed bridge row's prev_hash is covered only by a digest SSDF
  cannot recompute, so a forged link could have carried an anchor across
  deleted rows. Such rows now never extend a bridge walk and never count as
  genuinely archived (fail closed). Evidence chains anchor only directly on
  a checkpoint head.

Each new test fails when its guard is reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hash

Codex review of 998b214 (P1: an attacker who relabels a sovereign chain as
evidence AND rewrites every row_hash and prev_hash to writer-shaped values
passes verify_tier). Rejected, with evidence. On unchanged main, the same
full rewrite of an uncheckpointed Python-hashed chain (edit content,
recompute every hash, relink) already verifies clean, because the chain
hash is unkeyed. Resisting a full rewrite is the job of signed checkpoints,
not of the per-row scheme. Against a checkpointed chain the relabel attack
is caught: the original chain's signed head goes missing and is reported
as checkpoint_head_missing. This test pins that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fastrevmd-lab
fastrevmd-lab merged commit e8651a7 into main Oct 26, 2026
15 checks passed
@fastrevmd-lab
fastrevmd-lab deleted the fix/evidence-tier-verify-wt branch October 26, 2026 23:33
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