// Controlul negativ al SBOM-ului Maven (sbom-maven.test.mjs, Proof of Software 1.6.0), prin mecanismul comun din _control.mjs: // fiecare paznic scos intr-o copie a lui pos.mjs trebuie sa inroseasca EXACT proba lui, cu suita chiar rulata (trei stari: ROSU cum // trebuia / CONTROL CAZUT / STRICAT cand ancora nu se poate pune sau suita nu ajunge la rezumat). // node aerenew/tools/proof-of-software/test/sbom-maven-control-negativ.mjs import { controleaza } from './_control.mjs'; process.exitCode = await controleaza('sbom-maven.test.mjs', [ ['nodurile scoase de mediere listate drept componente', 'const mediat = n.included !== true && n.selectedVersion != null;', 'const mediat = false;', 'componentele = artefactele INCLUSE'], ['artefactele inregistrate dinamic nu mai sunt marcate', 'dinamic: n.selectedVersion == null }, id);', 'dinamic: false }, id);', 'componentele = artefactele INCLUSE'], ['muchia unui copil scos de mediere nu mai trimite la versiunea aleasa', "muchii.push([deLa, purlMavenQ(n.groupId, n.artifactId, n.selectedVersion, classifier, type), `${id} (mediated to ${n.selectedVersion})`]);", '', 'graful: radacina'], ['hash-urile nu mai sunt scrise', '...(c.hash && MAVEN_HEX[c.hash.alg] ? { hashes: [{ alg: c.hash.alg, content: c.hash.sum }] } : {}),', '...({}),', 'hashes: fiecare componenta'], ['pom.xml comis nu mai e comparat cu pom.checksum (mereu true)', "potrivire = alg ? String(crypto.createHash(alg).update(pomOcteti).digest('hex') === String(j.pom.checksum).toLowerCase()) : `not comparable (${j.pom.checksumAlgorithm})`;", "potrivire = 'true';", 'CONTROL POZITIV al metodei: pom.checksum'], ['clasificatorul scos din purl (sources si javadoc ale aceluiasi artefact se suprapun)', "const q = [['classifier', classifier || null], ['type', type && type !== 'jar' ? type : null]]", "const q = [['type', type && type !== 'jar' ? type : null]]", 'purl-uri verificate de mana'], ['scope-ul scos din proprietati', "'aere:maven-role': [...c.roluri].sort().join(','), 'aere:maven-scope': c.scopes.size ? [...c.scopes].sort().join(',') : null,", "'aere:maven-role': [...c.roluri].sort().join(','), 'aere:maven-scope': null,", 'scope-urile si rolurile se aduna'], ['pluginurile nu mai sunt componente', "const pluginuri = unelte(j.mavenPlugins, 'plugin', 'mavenPlugins'), extensii", 'const pluginuri = 0, extensii', 'pluginurile (17) si pom-urile'], ['doua checksum-uri pentru aceeasi coordonata primite', 'if (comp.has(purl) && (c.hash && c.hash.sum) !== (h && h.sum)) throw', 'if (false) throw', 'CONTROL: un lockfile stricat'], ['id-ul care nu numeste g:a:v primit', 'if (n.id != null && n.id !== id) throw', 'if (false) throw', 'CONTROL: un lockfile stricat'], ['un nod scos de mediere cu copii primit', 'if ((n.children || []).length) throw new Error(`lockfile.json: ${id} is omitted by mediation and still has children`);', '', 'CONTROL: un lockfile stricat'], ['tinta unei muchii mediate neverificata', 'for (const [, la, id] of muchii) if (!comp.has(la)) throw', 'for (const [, la, id] of muchii) if (false) throw', 'CONTROL: un lockfile stricat'], ['agregatorul fara lockfile nu mai numeste modulele', 'if (module.length) return { lipsa: `the committed tree has no lockfile.json; its pom.xml is an aggregator', 'if (false) return { lipsa: `the committed tree has no lockfile.json; its pom.xml is an aggregator', 'modulele: pom-ul agregator'], ['SBOM-ul Maven judecat ca npm la reconstructie', "'lockfile.json': 'maven' };", '};', 'verify --rebuild-from: SBOM-ul Maven'], ['numarul de serie aleator (SBOM-ul nu mai e determinist)', 'serialNumber: serieDerivata({ metadata, dependencies, components }),', "serialNumber: 'urn:uuid:' + crypto.randomUUID(),", 'determinist'], ['calea radacinii (.) trimisa la git ca `:.`, pe care git il refuza', "const caleGit = (commit, rel, f = '') => `${commit}:${!rel || rel === '.' ? '' : rel + (f ? '/' : '')}${f}`;", "const caleGit = (commit, rel, f = '') => `${commit}:${!rel ? '' : rel + (f ? '/' : '')}${f}`;", '--source-path . :'], ]);