verify-layer: the audit log as a Merkle tree (RFC 9162) - signed tree heads, and inclusion and consistency proofs anyone checks without the log

This commit is contained in:
Aere Network committed 2026-09-30 10:13:10 +03:00
1 parent f75c33454a
commit 082b862d78
7 files changed
+487 -4

No files matched your search

+22
View File
@@ -85,10 +85,32 @@ head, notarized in block 3,699,939 on 2026-09-27. Anyone can check both halves:
The first says the log is the one that was notarized; the second, measured on 2026-09-29, reports `finality: PASSED
post-quantum` under a certified anchor of the testnet, and `VALID`.
## The log as a Merkle tree (RFC 9162)
The same entries, seen as a Merkle tree in the manner of Certificate Transparency 2.0 (RFC 9162, section 2.1): leaf i is the hash
the chain already gives entry i, with the RFC's separation between leaves (`0x00`) and nodes (`0x01`). With the chain alone, checking
that one entry is in the log, or that a new head extends an old one, means receiving and replaying the whole log; with the tree, a
proof of about log2(n) hashes is enough and shows no other entry.
node sidecar.mjs tree-head --log audit.log --sign-key head.key.pem --out tree-head.json # size and root, an AIP-23 envelope
node sidecar.mjs prove-inclusion --log audit.log --seq 7 --out inclusion.json
node sidecar.mjs verify-inclusion --proof inclusion.json --head tree-head.json --signer head.pub.pem # no log needed
node sidecar.mjs prove-consistency --log audit.log --from 12 --out consistency.json
node sidecar.mjs verify-consistency --proof consistency.json --old head-12.json --new head-20.json --signer head.pub.pem
The tree head is signed with the operator's key in the same form as the chain head (so the AIP-23 verifier checks its signature),
and can be notarized. An inclusion proof carries the entry itself: the verifier recomputes its hash from its content and checks its
envelope, so an internal node cannot be passed off as an entry. A proof names a tree by its size and root; bind it to a head you
received (`--head`), not to the numbers in the proof. Two heads of the same log with no consistency proof between them mean the
history was rewritten. What it does not prove, as for the chain: that the entries are true (the host writes them), or that no
other log with other heads was shown to someone else; whoever receives heads from both, or notarized heads, sees it.
## Tests
node proba-sidecar.mjs # 44 checks
node control-negativ-sidecar.mjs # puts each guard back to its absent form and requires the named check to fail
node proba-arbore.mjs # 19: the tree (the reference roots of Certificate Transparency for 1..8 leaves, every proof up to 64 leaves, each attack)
node control-negativ-arbore.mjs # 13 guards removed in a copy, each turns its named test red
`proba-sidecar.mjs` records runtime, deployment and envelope entries; checks that a modified entry breaks the chain at its
seq, a changed hash is caught, and nothing is appended to a broken chain; that a chain **rebuilt from genesis** passes