device-identity: third adversarial review and its repairs (with the release left out of a bundle, the firmware the device attests is still judged against the manufacturer's policies; a verifier clock and every time read strictly as RFC 3339 UTC, days that do not exist refused; C1, DEL and direction marks escaped on the terminal; a key file is never overwritten); probe 372/372, negative control 220/220. conformance: the halves of the device verifier mapped again (263/263 under the negative control) and the present-tense counts brought to the measurement of 2026-10-14 (467 vectors, 467/467 with the AIP-23 verifier as served)

This commit is contained in:
Aere Network committed 2026-10-15 02:43:18 +03:00
1 parent ed4d3d79d8
commit 86779c8334
8 files changed
+263 -100

No files matched your search

+27 -16
View File
@@ -13,7 +13,7 @@ export const M = 'device.mjs', C = 'device-cli.mjs';
// the rows a planting must turn red can be derived from the witness run: by the rule they expect, or by the verdict they require
const cuRegula = (r) => (rows) => rows.filter((x) => x.expects.includes(r)).map((x) => x.id);
// every row that requires a PARTIAL verdict: the rows of that kind, and the rows of other kinds that require one among other things
const partiale = (rows) => [...rows.filter((x) => x.kind === 'partial').map((x) => x.id), 'D05', 'D08', 'D09', 'S24'];
const partiale = (rows) => [...rows.filter((x) => x.kind === 'partial').map((x) => x.id), 'D05', 'D08', 'D09', 'S24', 'W08'];
// every attack row that reaches the end of the verifier (a bundle refused for its form, or one that cannot be read, has no subject to return)
const cuSubiect = (rows) => rows.filter((x) => x.kind === 'attack' && !x.expects.includes('form') && !x.expects.includes('unreadable')).map((x) => x.id);
// the conditions of the windows, as they stand in the verifier
@@ -21,9 +21,9 @@ const FER = 'nb - sk <= acum && acum <= na && nb - sk <= tq && tq <= na /*PAZA:a
const PRO = 'tq <= acum + sk && acum - tq <= maxAgeS * 1000 /*PAZA:freshness*/';
const MW = 'vf - sk <= acum && acum <= vu /*PAZA:manufacture-window*/';
const ACE = 'a.id === b.id && canonical(a.keys) === canonical(b.keys)';
const DATA_ = "if (typeof s !== 'string' || !DATA.test(s) || Number.isNaN(Date.parse(s)))";
const DATA_ = "if (typeof s !== 'string' || !DATA.test(s) || !exista(s))";
const LISTA_A_LUI = "aceeasi(l.statement.issuer, S.issuer) && verifyText('status-list', canonical(l.statement), l.signature, S.issuer.keys)";
const POLITICA_A_LUI = "&& aceeasi(q.issuer, R.signer) && verifica('firmware-policy', q, p.signature, R.signer.keys)";
const POLITICA_A_LUI = "&& aceeasi(q.issuer, fw.signer) && verifica('firmware-policy', q, p.signature, fw.signer.keys)";
const CITIBIL = 'const citibil = s.v === VERSION && STATES.includes(s.state) && Number.isInteger(s.seq);';
const VEDERE = 'if (!v || s.seq > v.seq) vederi.set(s.by.id,';
const ROL = "S !== null && aceeasi(s.by, S.issuer) ? 'manufacturer' : aceeasi(s.by, owner) ? 'owner' : fosti.some((x) => aceeasi(s.by, x)) ? 'previous' : null;";
@@ -54,9 +54,12 @@ export const PLANTARI = [
['a member more beside the statement and the signature of an attestation is accepted', M, 'numai(X, LEGATURA) && numai(X.signature, SEMN_DISPOZITIV)', 'numai(X.signature, SEMN_DISPOZITIV)', ['M07']],
['a member more in the attestation\'s signature object is accepted', M, 'numai(X.signature, SEMN_DISPOZITIV) && X.signature.alg', 'X.signature.alg', ['M08']],
// the form of a time: three conditions
['a time in another form than RFC 3339 UTC is read (whatever a date parser understands)', M, DATA_, "if (typeof s !== 'string' || Number.isNaN(Date.parse(s)))", ['H21', 'H22']],
['a time that has the form of a time and is not a date is read', M, DATA_, "if (typeof s !== 'string' || !DATA.test(s))", ['T23']],
['a time that is not a text is read', M, DATA_, 'if (!DATA.test(s) || Number.isNaN(Date.parse(s)))', ['T22']],
['a time in another form than RFC 3339 UTC is read (whatever a date parser understands)', M, DATA_, "if (typeof s !== 'string' || Number.isNaN(Date.parse(s)))", ['H21', 'H22', 'W09', 'W10']],
['a time that has the form of a time and is not a date is read', M, DATA_, "if (typeof s !== 'string' || !DATA.test(s))", ['T23', 'W09', 'W10']],
['a time that is not a text is read', M, DATA_, 'if (!DATA.test(s) || !exista(s))', ['T22']],
// 2026-10-14 (third review): the check before was "the parser reads something" (Number.isNaN), and a date parser MOVES a day that does not exist
['a day that does not exist is read where the parser moves it (only what it cannot read at all is refused)', M, DATA_, "if (typeof s !== 'string' || !DATA.test(s) || Number.isNaN(Date.parse(s)))", ['W09', 'W10']],
['the verifier\'s clock is read by a date parser (a text without a zone is local time, "1" is the year 2001)', M, "typeof now === 'string' && DATA.test(now) && exista(now) ? Date.parse(now) : NaN", "typeof now === 'string' ? new Date(now).getTime() : NaN", ['W12', 'D11']],
// ---- the manufacture credential
['a manufacture credential that has not begun is accepted', M, MW, 'acum <= vu /*PAZA:manufacture-window*/', ['F01']],
['an expired manufacture credential is accepted', M, MW, 'vf - sk <= acum /*PAZA:manufacture-window*/', ['C05', 'H13']],
@@ -76,11 +79,13 @@ export const PLANTARI = [
['the id of who signed a release is not derived from its keys', M, 'idDin(R.signer.keys) === R.signer.id && (S === null', '(S === null', ['F26']],
['with two firmware policies the loosest floor holds', M, 'prag = Math.max(...curente', 'prag = Math.min(...curente', ['C22']],
['a retraction is lifted by a policy that does not list it', M, 'const retras = curente.some((p) => p.statement.retracted.some(', 'const retras = curente.every((p) => p.statement.retracted.some(', ['C24', 'D09']],
['a retraction written in upper case is not seen', M, 'const scris = (x) => String(x).toLowerCase();', 'const scris = (x) => String(x);', ['C24b']],
['a firmware policy of a stranger is believed', M, POLITICA_A_LUI, "&& verifica('firmware-policy', q, p.signature, q.issuer.keys)", ['B08']],
['a firmware policy is believed on the issuer it names (its signature is not checked)', M, POLITICA_A_LUI, '&& aceeasi(q.issuer, R.signer)', ['S19']],
['a firmware policy signed with the manufacturer\'s keys is believed whatever issuer it names', M, POLITICA_A_LUI, "&& verifica('firmware-policy', q, p.signature, R.signer.keys)", ['S20']],
['a firmware policy of another model is believed', M, 'return q.model === R.model && aceeasi(q.issuer, R.signer)', 'return aceeasi(q.issuer, R.signer)', ['F12']],
['a retraction written in upper case is not seen', M, 'const scris = (x) => String(x).toLowerCase();', 'const scris = (x) => String(x);', ['C24b', 'W04']],
['a firmware policy of a stranger is believed', M, POLITICA_A_LUI, "&& verifica('firmware-policy', q, p.signature, q.issuer.keys)", ['B08', 'W06']],
['a firmware policy is believed on the issuer it names (its signature is not checked)', M, POLITICA_A_LUI, '&& aceeasi(q.issuer, fw.signer)', ['S19']],
['a firmware policy signed with the manufacturer\'s keys is believed whatever issuer it names', M, POLITICA_A_LUI, "&& verifica('firmware-policy', q, p.signature, fw.signer.keys)", ['S20']],
['a firmware policy of another model is believed', M, 'return q.model === fw.model && aceeasi(q.issuer, fw.signer)', 'return aceeasi(q.issuer, fw.signer)', ['F12', 'W05']],
// 2026-10-14 (third review): with the release left out, the firmware the device attests was not judged against the policies at all
['with the release left out, the firmware the device attests is not judged against the policies', M, 'if (F == null && S !== null && Q !== null) judecaPolitici(', 'if (false) judecaPolitici(', ['W01', 'W02', 'W03', 'W04', 'W07']],
['a firmware policy of a version this verifier does not read is dropped in silence', M, "if (q.v !== VERSION) { necitite.push('it is of a version this verifier does not read'); continue; }", 'if (q.v !== VERSION) continue;', ['F19c']],
// the end of a policy's validity is no longer read: an expired policy counts, and a validity that is not a time is never looked at
['an expired firmware policy is read as current', M, "inVigoare = data(q.validFrom, 'policy validFrom') - sk <= acum && acum <= data(q.validUntil, 'policy validUntil');", "inVigoare = data(q.validFrom, 'policy validFrom') - sk <= acum;", ['F13', 'F14', 'F19b', 'H18']],
@@ -119,7 +124,7 @@ export const PLANTARI = [
['the ending of an authorization is given the tolerance at the time of the attestation', M, FER, 'nb - sk <= acum && acum <= na && nb - sk <= tq && tq <= na + sk /*PAZA:authorization-window*/', ['F05']],
// ---- status: whose record counts
['the manufacturer\'s retirement, and the owner\'s, are lifted like a suspension', M, "if (s.state === 'retired') { if (retras === null", "if (false) { if (retras === null", cuRegula('status-retired')],
['the manufacturer\'s records stop counting once the device is sold', M, "S !== null && aceeasi(s.by, S.issuer) ? 'manufacturer'", "S !== null && aceeasi(s.by, S.issuer) && aceeasi(s.by, owner) ? 'manufacturer'", ['A08', 'A08b', 'C51', 'C52', 'C53', 'C53b', 'C55', 'D05', 'G09', 'G11', 'G12', 'H28', 'J01', 'J04', 'K07', 'S01', 'S03', 'S06', 'S09', 'T16']],
['the manufacturer\'s records stop counting once the device is sold', M, "S !== null && aceeasi(s.by, S.issuer) ? 'manufacturer'", "S !== null && aceeasi(s.by, S.issuer) && aceeasi(s.by, owner) ? 'manufacturer'", ['A08', 'A08b', 'C51', 'C52', 'C53', 'C53b', 'C55', 'D05', 'G09', 'G11', 'G12', 'H28', 'J01', 'J04', 'K07', 'S01', 'S03', 'S06', 'S09', 'T16', 'W08']],
['anyone can write a status record', M, "fosti.some((x) => aceeasi(s.by, x)) ? 'previous' : null;", "fosti.some((x) => aceeasi(s.by, x)) ? 'previous' : 'owner';", ['A06', 'J05', 'K01', 'K02', 'K03', 'K04', 'K05', 'K06', 'S25']],
['a record of a PREVIOUS owner binds the owner of now', M, "aceeasi(s.by, x)) ? 'previous' : null;", "aceeasi(s.by, x)) ? 'owner' : null;", ['A07', 'D07', 'G06', 'G07', 'G08', 'G14', 'I10', 'J06']],
['an owner that owned the device before is taken for a previous owner (the order of the roles turned round)', M, ROL, "S !== null && aceeasi(s.by, S.issuer) ? 'manufacturer' : fosti.some((x) => aceeasi(s.by, x)) ? 'previous' : aceeasi(s.by, owner) ? 'owner' : null;", ['A11', 'G03', 'G04', 'G05']],
@@ -207,8 +212,10 @@ export const PLANTARI = [
['the private half of a device key is enumerable', M, "Object.defineProperty(d, 'privat', { value: priv, enumerable: false });", "Object.defineProperty(d, 'privat', { value: priv, enumerable: true });", ['D01']],
// ---- text made visible
['visible(): a backslash is not doubled (a visible form can be forged)', M, 'if (n === 0x5c) out +=', 'if (false) out +=', ['V01']],
['visible(): the C1 control characters are sent as they are', M, '[0x7f, 0x9f]', '[0x7f, 0x7f]', ['D10', 'V01']],
['visible(): the line and paragraph separators are sent as they are', M, '[0x2028, 0x202e]', '[0x202a, 0x202e]', ['D10', 'V01']],
['visible(): the C1 control characters are sent as they are', M, '[0x7f, 0x9f]', '[0x7f, 0x7f]', ['D10', 'V01', 'W13', 'D10b']],
['visible(): the line and paragraph separators are sent as they are', M, '[0x2028, 0x202e]', '[0x202a, 0x202e]', ['D10', 'V01', 'W13', 'D10b']],
// 2026-10-14 (third review): U+061C ARABIC LETTER MARK has the Unicode property Bidi_Control and was printed as it came
['visible(): the arabic letter mark is sent as it is', M, '[0x061c, 0x061c], ', '', ['D10', 'V01', 'W13', 'D10b']],
// ---- the command line
['the command line exits 0 whatever the verdict', C, "return r.verdict === 'VALID' ? 0 : r.verdict === 'INVALID' ? 1 : 2;", 'return 0;', ['D05', 'D07', 'D09', 'D10']],
['the command line does not say what is named beside the verdict', C, 'if (notate.length) spune(', 'if (false) spune(', ['D07']],
@@ -216,7 +223,11 @@ export const PLANTARI = [
['the command line hands a file that holds a list as ONE thing (it is not read element by element)', C, LISTE_CLI, "o.statusLists = toate('--status-list').map(citeste); o.firmwarePolicies = toate('--policy').map(citeste); o.statusRecords = toate('--status').map(citeste); o.anchors = toate('--reading').map(citeste);", ['D09']],
['the command line does not open a registry object { records: [...] }', C, " : x && typeof x === 'object' && Array.isArray(x.records) && x.statement === undefined ? netezeste(x.records, adancime + 1) : [x]);", ' : [x]);', ['D09']],
['the command line prints text from a bundle as it came (control characters reach the terminal)', C, 'const spune = (text) => { console.log(D.visible(text)); };', 'const spune = (text) => { console.log(text); };', ['D10']],
['the command line passes its JSON through visible() (it is no longer the bundle\'s text)', C, "if (rest.includes('--json')) console.log(JSON.stringify(r, null, 1));", "if (rest.includes('--json')) spune(JSON.stringify(r, null, 1));", ['D05', 'D07', 'D09', 'D10b']],
['an input that cannot be read exits with the code of a PARTIAL verdict', C, 'const COD_FOLOSIRE = 3, COD_CADERE = 4;', 'const COD_FOLOSIRE = 2, COD_CADERE = 4;', ['D11']],
['the command line passes its JSON through visible() (it is no longer the bundle\'s text)', C, "if (rest.includes('--json')) console.log(D.visibleJson(r, 1));", "if (rest.includes('--json')) spune(D.visibleJson(r, 1));", ['D05', 'D07', 'D09', 'D10b']],
// 2026-10-14 (third review): JSON.stringify escapes C0 only; DEL, C1, the marks of direction and the line separators reached the terminal
['the command line prints its JSON as JSON.stringify writes it', C, "if (rest.includes('--json')) console.log(D.visibleJson(r, 1));", "if (rest.includes('--json')) console.log(JSON.stringify(r, null, 1));", ['D10b']],
['a key file is written over a file that exists (the key it held is lost, and the file keeps its own mode)', C, "secret ? { mode: 0o600, flag: 'wx' } : {}", 'secret ? { mode: 0o600 } : {}', ['D12']],
['a trusted manufacturer file that holds no keys exits as an unexpected failure', C, 'catch (e) { throw new Folosire(`${f} holds no public keys', 'catch (e) { throw new Error(`${f} holds no public keys', ['D11']],
['an input that cannot be read exits with the code of a PARTIAL verdict', C, 'const COD_FOLOSIRE = 3, COD_CADERE = 4;', 'const COD_FOLOSIRE = 2, COD_CADERE = 4;', ['D11', 'D12']],
['a clock that is not a time exits as an unexpected failure, not as an input that cannot be read', C, 'if (/^verifyDevice: /.test(String(e && e.message))) throw new Folosire(e.message);', 'if (false) throw new Folosire(e.message);', ['D11']],
];