verify-layer: signed heads. keygen makes the operator's ML-DSA-65 head key; attest-head --sign-key signs the head statement in the form the AIP-23 reference verifier checks at its signature level (outside the statement, so the statementHash and its notarization are unchanged); verify-log --attested --signer requires the expected key, and without it says who signed and that no expected signer was compared. A signature says who vouches for the head, not when and not that the history is true. Tests 44/44 with the reference verifier (39 run and 5 skipped without it); negative control 9/9 here.

This commit is contained in:
Aere Network committed 2026-09-29 22:58:20 +03:00
1 parent 6e62b1ad1a
commit 35d711fa55
5 files changed
+122 -24

No files matched your search

+9
View File
@@ -8,6 +8,9 @@
// P4 statementHash-ul capului atestat nu se mai reface -> R CONTROL (cap manipulat) rosu
// P5 un rand care nu e JSON arunca din nou (cadere) -> N rosu
// P6 --attested nu se mai cere digest -> N CONTROL rosu
// P7 semnatura capului nu se mai verifica (punctul 34, 2026-09-29) -> S CONTROL (semnatura stricata) rosu
// P8 semnatarul capului nu se mai compara cu --signer -> S CONTROL (alta cheie) rosu
// P9 un cap nesemnat trece cand --signer il cere semnat -> S CONTROL (nesemnat) rosu
// Copiile stau LANGA original (importul lui proof-kinds e relativ) si se sterg; originalul trebuie sa ramana octet cu octet.
// node control-negativ-sidecar.mjs -> 0 toate prinse, 1 una scapata, 2 STRICAT
import crypto from 'node:crypto';
@@ -31,6 +34,9 @@ const T = {
necitibil: 'N: rand care nu e JSON',
digest: 'N CONTROL: --attested care nu e digest',
concurent: 'C: doi scriitori concurenti',
semnStricata: 'S CONTROL: o semnatura de cap stricata',
altaCheie: 'S CONTROL: capul semnat de alta cheie',
nesemnat: 'S CONTROL: un cap nesemnat',
};
function caz(id, text, tinte) {
@@ -65,6 +71,9 @@ const P = [
['P4', "if (!eDigest(cap.statementHash) || sha256(Buffer.from(JSON.stringify(st), 'utf8')) !== cap.statementHash.toLowerCase()) return", `if (!eDigest(cap.statementHash) || (sha256(Buffer.from(JSON.stringify(st), 'utf8')) !== cap.statementHash.toLowerCase() && ${NU})) return`, [T.capMan]],
['P5', "try { return JSON.parse(l); } catch { return { necitibil: true }; }", `try { return JSON.parse(l); } catch (e) { if (${NU}) return { necitibil: true }; throw e; }`, [T.necitibil]],
['P6', 'if (!eDigest(attested)) {', `if (!eDigest(attested) && ${NU}) {`, [T.digest]],
['P7', "if (!ok) return { ok: false, semnat: true, keyId: idCheie(pub), motiv: 'the head signature does not verify over the statement' };", `if (!ok && ${NU}) return { ok: false, semnat: true, keyId: idCheie(pub), motiv: 'the head signature does not verify over the statement' };`, [T.semnStricata]],
['P8', 'if (idCheie(asteptat) !== idCheie(pub)) return', `if (idCheie(asteptat) !== idCheie(pub) && ${NU}) return`, [T.altaCheie]],
['P9', 'if (!s) return semnatarPem ? { ok: false,', `if (!s) return (semnatarPem && ${NU}) ? { ok: false,`, [T.nesemnat]],
];
for (const [id, a, b, tinte] of P) {
let t = planta(nou, a, b);