crypto-inventory 0.3.0 and the control-plane planner after the second run on a tree that is not ours (libsignal): BoringSSL, Noise hfs, libcrux Kyber, the libsignal Java/Node API; self-signed trust anchors are blocked, test code is LOW with its own scope

This commit is contained in:
Aere Network committed 2026-10-18 07:52:31 +03:00
1 parent 42b049ef04
commit e453c0c42d
35 files changed
+675 -51

No files matched your search

+33 -1
View File
@@ -1,5 +1,5 @@
// Detectorul JavaScript / TypeScript: node:crypto, WebCrypto, optiuni TLS, biblioteci din importuri.
import { argumente, imparteArgumente, valoareArgument, necunoscut, obiectulDin, cifruOpenssl, identificator, rezolva } from './context.mjs';
import { argumente, imparteArgumente, valoareArgument, necunoscut, obiectulDin, cifruOpenssl, identificator, rezolva, escapeRe } from './context.mjs';
import { hashCanonic, grupTls, jws, JWS_RE } from './catalog.mjs';
const MODP = { modp1: 768, modp2: 1024, modp5: 1536, modp14: 2048, modp15: 3072, modp16: 4096, modp17: 6144, modp18: 8192 };
@@ -487,6 +487,38 @@ function detecteazaBiblioteci(ctx, imp, importa, jwtLib) {
ctx.adauga(nacl[0].pos, `import ${nacl[0].spec}`, 'import', { grup: 'LIB-MULTI', nume: nacl[0].spec }, { suprimaDe: ['EDDSA', 'XDH', 'CIPHER'], bucata: `import ${nacl[0].spec}` });
}
// @signalapp/libsignal-client (Node; 2026-10-18, dupa rularea pe arborele libsignal: 173 de fisiere TypeScript si zero constatari,
// fiindca API-ul lui sta peste puntea nativa, nu peste node:crypto). Ancora e importul pachetului: numele scurte (PrivateKey, hkdf)
// nu inseamna libsignal in alt cod. Arborele libsignal insusi importa prin cai relative, deci acolo ramane nevazut; aici se recunoaste
// ce foloseste un CLIENT al bibliotecii.
const lsc = importa(/^@signalapp\/libsignal-client(\/.*)?$/);
if (lsc.length) {
const notaEc = 'libsignal Curve25519 key pair: used for Diffie-Hellman (X3DH/PQXDH, Double Ratchet) and for XEdDSA signatures over the same key.';
const bundle = { grup: 'LIB-MULTI', nume: 'libsignal session setup (X3DH/PQXDH)', motiv: 'libsignal prekey bundle: Curve25519 identity and signed prekey; a Kyber prekey in the bundle makes the session PQXDH (hybrid). Which prekeys the bundle carries is decided at run time.' };
for (const m of ctx.potriviri(/(?<![\w$.])(?:[\w$]+\s*\.\s*)?(PrivateKey|IdentityKeyPair)\s*\.\s*generate\s*\(/g)) {
ctx.adauga(m.index, `${m[1]}.generate`, 'call', { grup: 'XDH', nume: 'X25519', functii: ['keygen'], nota: notaEc }, { bucata: m[0] });
}
for (const m of ctx.potriviri(/(?<![\w$.])(?:[\w$]+\s*\.\s*)?KEMKeyPair\s*\.\s*generate\s*\(/g)) {
ctx.adauga(m.index, 'KEMKeyPair.generate', 'call', { grup: 'PREPQ', nume: 'Kyber-1024', primitiv: 'kem', functii: ['keygen'], nota: 'libsignal-client KEMKeyPair.generate() produces a Kyber-1024 pair (the PQXDH prekey; the only KEM type the Node API exposed when this rule was written).' }, { bucata: m[0] });
}
// hkdf: numai numele importat din pachet sau prin aliasul lui de spatiu de nume (node:crypto are si el un hkdf, recunoscut mai sus)
const numeHkdf = lsc.flatMap((i) => i.locale.filter((_, k) => i.importate[k] === 'hkdf'));
const aliasuri = lsc.map((i) => i.implicit).filter(Boolean);
const forme = [...numeHkdf.map((n) => `${escapeRe(n)}`), ...aliasuri.map((a) => `${escapeRe(a)}\\s*\\.\\s*hkdf`)];
if (forme.length) {
for (const m of ctx.potriviri(new RegExp(`(?<![\\w$.])(?:${forme.join('|')})\\s*\\(`, 'g'))) {
ctx.adauga(m.index, 'hkdf', 'call', { grup: 'KDF', nume: 'HKDF', hash: 'SHA256', functii: ['keyderive'], nota: 'libsignal HKDF is HKDF-SHA-256.' }, { bucata: m[0] });
}
}
for (const m of ctx.potriviri(/(?<![\w$.])(?:[\w$]+\s*\.\s*)?Aes256GcmSiv\s*\.\s*new\s*\(/g)) {
ctx.adauga(m.index, 'Aes256GcmSiv.new', 'call', { grup: 'CIPHER', nume: 'AES', param: '256', mod: 'gcm-siv', functii: ['encrypt'] }, { bucata: m[0] });
}
for (const m of ctx.potriviri(/(?<![\w$.])(?:[\w$]+\s*\.\s*)?(PreKeyBundle\s*\.\s*new|processPreKeyBundle)\s*\(/g)) {
ctx.adauga(m.index, m[1].replace(/\s+/g, ''), 'call', bundle, { bucata: m[0] });
}
ctx.adauga(lsc[0].pos, `import ${lsc[0].spec}`, 'import', { grup: 'LIB-MULTI', nume: '@signalapp/libsignal-client', motiv: 'Imports the Signal protocol library for Node (Curve25519 identity and prekeys, Kyber prekeys (PQXDH), Double Ratchet, SPQR, sealed sender); no specific call recognized in this file.' }, { suprimaDe: ['XDH', 'PREPQ', 'MLKEM', 'KDF', 'CIPHER', 'LIB-MULTI'], bucata: `import ${lsc[0].spec}` });
}
// node-rsa
const nrsa = importa(/^node-rsa$/);
if (nrsa.length) {