conformance: 97 rules of 9 verifiers, 206 vectors; verify-layer and agents refuse a classical key under an ML-DSA-65 name; market-settlement reads the notarization time from the certified read; proof-of-ai README in English
This commit is contained in:
1 parent
c9f2932e04
commit
c9798a0013
111 files changed
+15871
-292
No files matched your search
+88
-8
@@ -20,11 +20,25 @@ export const MODULE = {
|
||||
chitanta: { url: new URL('../payments/chitanta.mjs', import.meta.url), env: 'AERE_CONF_MODUL_CHITANTA' },
|
||||
piata: { url: new URL('../market-settlement/piata.mjs', import.meta.url), env: 'AERE_CONF_MODUL_PIATA' },
|
||||
baza: { url: new URL('../verifiable-data/baza.mjs', import.meta.url), env: 'AERE_CONF_MODUL_BAZA' },
|
||||
aitrust: { url: new URL('../ai-trust/lant-de-incredere.mjs', import.meta.url), env: 'AERE_CONF_MODUL_AITRUST' },
|
||||
sidecar: { url: new URL('../verify-layer/sidecar.mjs', import.meta.url), env: 'AERE_CONF_MODUL_SIDECAR' },
|
||||
arbore: { url: new URL('../verify-layer/jurnal-arbore.mjs', import.meta.url), env: 'AERE_CONF_MODUL_ARBORE' },
|
||||
ledger: { url: new URL('../agents/agent-ledger.mjs', import.meta.url), env: 'AERE_CONF_MODUL_LEDGER' },
|
||||
};
|
||||
export const caleModul = (k) => process.env[MODULE[k].env] || fileURLToPath(MODULE[k].url);
|
||||
export const incarca = (k) => import(pathToFileURL(caleModul(k)).href);
|
||||
|
||||
const I = 'integrity';
|
||||
const I = 'integrity', AU = 'authenticity', AN = 'anchoring';
|
||||
/**
|
||||
* How a verifier MARKS its rules in code. `paza`: a comment marker on every check of a rule (the planting makes the marked check true).
|
||||
* `apel`: every refusal names its rule where it calls the verifier's one refusal helper (`apel.re` finds those calls; `apel.planteaza`
|
||||
* rewrites that helper, in a copy, so that it drops the refusals of one rule). Either way a rule is planted out WHOLE, in a copy.
|
||||
*/
|
||||
const APEL = {
|
||||
aitrust: { re: /(?:\bfail|fail : unm\))\('[a-z]+', '([a-z-]+)'/g,
|
||||
planteaza: (src, r) => { const a = "const fail = (l, reason, detail) => { if (!REGULI.includes(reason)) throw new Error('ai-trust: undeclared rule ' + reason); "; return src.split(a).length === 2 ? src.replace(a, () => a + `if (reason === '${r}') return; `) : null; } },
|
||||
};
|
||||
export const marcajul = (sursa) => APEL[sursa] || null;
|
||||
/** verifier -> { artifacts it judges, where its rules come from, source rule -> [public id, level, what the rule says] } */
|
||||
export const VERIFICATOARE = {
|
||||
'aip23-envelope': { artifacts: ['envelope'], sursa: 'verify-proof', reguli: {
|
||||
@@ -67,6 +81,72 @@ export const VERIFICATOARE = {
|
||||
completitudine: ['dataset.completeness', I, 'the rows are the whole contiguous run; the neighbours on both sides are outside the range'],
|
||||
consistenta: ['dataset.consistency', I, 'the older log is a prefix of the newer (RFC 9162 consistency) and the versions are linked'],
|
||||
esantion: ['dataset.sample', I, 'every sampled position is served and verifies'] } },
|
||||
'ai-trust': { artifacts: ['ai-trust-bundle'], sursa: 'aitrust', reguli: {
|
||||
form: ['aitrust.form', I, 'the bundle has the format, an identity, a ledger with its policy, and a Proof of AI envelope'],
|
||||
'identity-mismatch': ['aitrust.identity-mismatch', AU, 'the id derived from the key is the one the bundle, the ledger and the output name'],
|
||||
'identity-key': ['aitrust.identity-key', AU, 'the public key of the identity can be read'],
|
||||
'version-attestation': ['aitrust.version-attestation', I, 'the Proof of Software attestation of the model artifact verifies as an envelope'],
|
||||
'version-artifact-mismatch': ['aitrust.version-artifact-mismatch', I, 'the output names model weights that the attestation covers'],
|
||||
'version-label-mismatch': ['aitrust.version-label-mismatch', I, 'the output and the attestation name the same model version'],
|
||||
'runtime-record': ['aitrust.runtime-record', I, 'the runtime record is a verified runtime attestation'],
|
||||
'runtime-artifact-mismatch': ['aitrust.runtime-artifact-mismatch', I, 'the host ran the artifact the output names'],
|
||||
'runtime-after-output': ['aitrust.runtime-after-output', I, 'the runtime record is not dated after the output'],
|
||||
'audit-log-broken': ['aitrust.audit-log-broken', I, 'the hash chain of the audit log given is intact'],
|
||||
'runtime-not-in-audit-log': ['aitrust.runtime-not-in-audit-log', I, 'the runtime record is an entry of the audit log given'],
|
||||
'audit-head': ['aitrust.audit-head', I, 'the audit log continues the attested head given'],
|
||||
'witness-head': ['aitrust.witness-head', AN, 'every notarized head given is a head of this ledger, recorded on the chain'],
|
||||
'policy-hash': ['aitrust.policy-hash', I, 'the policy given hashes to the policy hash the bundle pins'],
|
||||
'ledger-invalid': ['aitrust.ledger-invalid', I, 'the ledger verifies under its policy (signatures, chain, every decision re-derived)'],
|
||||
'output-not-in-ledger': ['aitrust.output-not-in-ledger', I, 'a ledger entry links this Proof of AI envelope'],
|
||||
'action-refused': ['aitrust.action-refused', I, 'the ledger entry of the output was allowed by the policy'],
|
||||
'ledger-time-mismatch': ['aitrust.ledger-time-mismatch', I, 'the ledger entry and the output are dated within the tolerance'],
|
||||
policy: ['aitrust.policy', I, 'the policy given is a policy'],
|
||||
'provenance-envelope': ['aitrust.provenance-envelope', I, 'the Proof of AI envelope verifies as an envelope of its kind'],
|
||||
'provenance-finality': ['aitrust.provenance-finality', AN, 'a notarization the Proof of AI envelope claims is on the chain'] } },
|
||||
'audit-log': { artifacts: ['audit-log'], sursa: 'sidecar', reguli: {
|
||||
intrare: ['auditlog.entry', I, 'the log is a list, and each entry is a log entry'],
|
||||
seq: ['auditlog.seq', I, 'the entries are numbered from zero, without a gap'],
|
||||
lant: ['auditlog.chain', I, 'each entry links the hash of the one before it'],
|
||||
hash: ['auditlog.hash', I, 'the hash of each entry is the hash of its content'],
|
||||
'cap-forma': ['auditlog.head-form', I, 'the attested head is an audit head attestation with a count and a head hash'],
|
||||
'cap-hash': ['auditlog.head-hash', I, 'the statementHash of the attested head is the hash of its statement'],
|
||||
'cap-nesemnat': ['auditlog.head-unsigned', AU, 'the head is signed when a signer is required'],
|
||||
'cap-schema': ['auditlog.head-scheme', AU, 'the head signature is an ml-dsa-65 signature, made with an ML-DSA-65 key'],
|
||||
'cap-cheie': ['auditlog.head-key', AU, 'the public key of the head signature can be read'],
|
||||
'cap-semnatura': ['auditlog.head-signature', AU, 'the head signature verifies over the statement'],
|
||||
'cap-semnatar': ['auditlog.head-signer', AU, 'the head is signed by the expected signer'],
|
||||
'cap-scurt': ['auditlog.head-short', I, 'the log has at least as many entries as the attested head covers'],
|
||||
'cap-rescris': ['auditlog.head-rewritten', I, 'the entry at the attested point is the attested head (the history before it was not rewritten)'] } },
|
||||
'audit-tree': { artifacts: ['audit-inclusion', 'audit-consistency'], sursa: 'arbore', reguli: {
|
||||
'dovada-forma': ['audittree.proof-form', I, 'the proof is an inclusion or a consistency proof that can be read'],
|
||||
'arbore-forma': ['audittree.head-form', I, 'the tree head is a tree head attestation with a size and a root'],
|
||||
'arbore-hash': ['audittree.head-hash', I, 'the statementHash of the tree head is the hash of its statement'],
|
||||
'includere-index': ['audittree.inclusion-index', I, 'the entry shown is the entry of the index proven'],
|
||||
'includere-intrare': ['audittree.inclusion-entry', I, 'the hash of the entry shown is the hash of its content'],
|
||||
'includere-plic': ['audittree.inclusion-envelope', I, 'the envelope inside the entry hashes to its statementHash'],
|
||||
'includere-frunza': ['audittree.inclusion-leaf', I, 'the leaf is the leaf of this entry'],
|
||||
'includere-drum': ['audittree.inclusion-path', I, 'the path leads from the leaf to the root (RFC 9162 inclusion)'],
|
||||
'includere-cap': ['audittree.inclusion-head', I, 'the proof is for the tree of the head given (size and root)'],
|
||||
'consistenta-inceput': ['audittree.consistency-start', I, 'the consistency proof starts at the old head'],
|
||||
'consistenta-sfarsit': ['audittree.consistency-end', I, 'the consistency proof ends at the new head'],
|
||||
consistenta: ['audittree.consistency', I, 'the new tree extends the old one (RFC 9162 consistency)'] } },
|
||||
'agent-ledger': { artifacts: ['agent-ledger'], sursa: 'ledger', reguli: {
|
||||
registru: ['agents.ledger-form', I, 'a ledger with a list of entries is given'],
|
||||
politica: ['agents.policy', I, 'the policy given is a policy, and hashes to the hash the verifier pins'],
|
||||
'alta-politica': ['agents.other-policy', I, 'the ledger and every entry name the policy given, and the policy is this agent\'s'],
|
||||
sesiune: ['agents.session', I, 'the session is the one derived from the agent and the policy'],
|
||||
cheie: ['agents.key', AU, 'the agent key can be read and is an ML-DSA-65 key'],
|
||||
identitate: ['agents.identity', AU, 'the agent id is derived from the key'],
|
||||
ancora: ['agents.anchor', I, 'every anchor given names an entry of this ledger, with a time'],
|
||||
seq: ['agents.seq', I, 'the entries are numbered from zero, without a gap'],
|
||||
lant: ['agents.chain', I, 'each entry links the hash of the one before it'],
|
||||
corp: ['agents.body', I, 'the body of an entry names the agent, the session and the sequence number of its header'],
|
||||
semnatura: ['agents.signature', AU, 'every entry is signed by the agent key'],
|
||||
hash: ['agents.hash', I, 'the hash of each entry reproduces'],
|
||||
timp: ['agents.time', I, 'entry times do not go backwards and stay within the bounds the verifier has (its clock, a witnessed start, the anchors)'],
|
||||
revocare: ['agents.revocation', I, 'a revocation entry carries a revocation that verifies, and says what it carries'],
|
||||
aprobari: ['agents.approvals', I, 'an approvals field, when present, is a list that is not empty'],
|
||||
decizie: ['agents.decision', I, 'every decision written is the decision the policy gives when replayed'] } },
|
||||
};
|
||||
/**
|
||||
* The FAILED sites of verify-proof's `finality` level, classified. `fragment` must appear on exactly one such source line; `re`
|
||||
@@ -83,10 +163,7 @@ export const FINALITY_SITES = [
|
||||
];
|
||||
/** Verifiers published beside these that the suite does NOT enrol yet, with the pattern that counts their refusal sites. */
|
||||
export const NEINROLATE = [
|
||||
{ name: 'ai-trust', files: [new URL('../ai-trust/lant-de-incredere.mjs', import.meta.url)], re: /\bfail\('[a-z-]+', '[a-z-]+'/g, why: 'its refusals already carry a level and a code; enrolling it is a vector per code, not done here' },
|
||||
{ name: 'agents (ledger)', files: [new URL('../agents/agent-ledger.mjs', import.meta.url)], re: /ok: false, error:/g, why: 'its refusals are free text; a rule id per refusal comes first' },
|
||||
{ name: 'identity', files: [new URL('../identity/identity.mjs', import.meta.url)], re: /\bok\('/g, why: 'its checks are labelled rows, not rule ids' },
|
||||
{ name: 'verify-layer (log and tree)', files: [new URL('../verify-layer/sidecar.mjs', import.meta.url), new URL('../verify-layer/jurnal-arbore.mjs', import.meta.url)], re: /ok: false/g, why: 'its refusals are free text; a rule id per refusal comes first' },
|
||||
{ name: 'identity', files: [new URL('../identity/identity.mjs', import.meta.url)], re: /\bok\(['`]/g, why: 'its checks are labelled rows, not rule ids (counted: the check rows of its presentation verifier; its SD-JWT, Travel Rule and compliance verifiers are not counted)' },
|
||||
];
|
||||
|
||||
/** public rule id -> { verifier, source, level, says } for every mapped rule */
|
||||
@@ -121,9 +198,12 @@ export async function deriva({ cai = {} } = {}) {
|
||||
const p = cai[d.sursa] || fileURLToPath(MODULE[d.sursa].url); const src = fs.readFileSync(p, 'utf8'); const M = await import(pathToFileURL(p).href);
|
||||
if (!Array.isArray(M.REGULI)) { probleme.push(`${v}: the module does not export REGULI`); continue; }
|
||||
declared = [...M.REGULI];
|
||||
for (const m of src.matchAll(/\/\*PAZA:([a-z]+)\*\//g)) sites[m[1]] = (sites[m[1]] || 0) + 1;
|
||||
for (const r of declared) if (!sites[r]) probleme.push(`${v}: rule ${r} is declared and no check carries its marker`);
|
||||
for (const r of Object.keys(sites)) if (!declared.includes(r)) probleme.push(`${v}: a check is marked ${r}, a rule the module does not declare`);
|
||||
const ap = APEL[d.sursa];
|
||||
for (const m of src.matchAll(ap ? ap.re : /\/\*PAZA:([a-z-]+)\*\//g)) sites[m[1]] = (sites[m[1]] || 0) + 1;
|
||||
for (const r of declared) if (!sites[r]) probleme.push(`${v}: rule ${r} is declared and no ${ap ? 'refusal names it' : 'check carries its marker'}`);
|
||||
for (const r of Object.keys(sites)) if (!declared.includes(r)) probleme.push(`${v}: a ${ap ? 'refusal names' : 'check is marked'} ${r}, a rule the module does not declare`);
|
||||
if (ap) for (const r of declared) if (ap.planteaza(src, r) === null) probleme.push(`${v}: the refusal helper is not where the planting expects it`);
|
||||
extra = { marked: ap ? 'at the refusal helper' : 'by a marker on every check' };
|
||||
}
|
||||
for (const r of declared) if (!d.reguli[r]) probleme.push(`${v}: the verifier names rule ${r} and the suite does not map it (a new rule needs a public id, a level and a vector)`);
|
||||
for (const r of Object.keys(d.reguli)) if (!declared.includes(r)) probleme.push(`${v}: the suite maps rule ${r}, which the verifier no longer names`);
|
||||
|
||||
Reference in new issue
Block a user