crypto-inventory 0.3.0: glob imports resolved, libcrux and spqr, libsignal KEM key pairs; control-plane: a key agreement or client-side TLS called by the application itself is not routed to the TLS gateway (planner 35/35, B1 negative control 4/4)

This commit is contained in:
Aere Network committed 2026-10-18 05:59:35 +03:00
1 parent f2f6217b4c
commit f971fa9e28
11 files changed
+161 -30

No files matched your search

+9
View File
@@ -15,6 +15,15 @@ documentation are in English (the data format was translated on 2026-09-29, vers
Runs the inventory on a code directory and, optionally, takes a scan of a hostname (the JSON of the readiness scanner), and writes a
prioritized plan. Every quantum-vulnerable asset becomes an action:
Since 2026-10-18 (first run on a code base that is not ours, a Rust messenger): a key agreement that the
application calls itself (X25519 in a ratchet, a PQXDH handshake, a Tor `ntor` handshake, `createECDH` in
Node) is **not** routed to the PQ Gateway, because a TLS edge cannot see it; its action is `manual`, in
code, with the hybrid target written out (X25519 + ML-KEM-768 in the same handshake and key schedule). A
signature or public-key encryption that the application performs itself keeps its PKI/KMS action (the
product issues the hybrid key, for real), and `how` says that the call site must then be changed to use it.
Only a finding with no call context (no `api`, no language) keeps the old routing: its context is not
known, so it is not guessed. The inventory's TLS configuration findings still go to the gateway.
{ ref, asset, problem, current, target, method: "auto-aere" | "manual" | "blocked", product: "gateway" | "kms" | "pki" | null,
how, cn?, primitive?, urgency: "CRITICAL" | "HIGH" | "MEDIUM" | "LOW", blocker, location, source }
+3
View File
@@ -41,6 +41,9 @@ function laPlanificator(g) {
curve: g.curve, parameterSetIdentifier: g.parameterSetIdentifier,
certificate: g.certificate,
material: g.material,
// 2026-10-18: contextul apelului merge la planificator; fara el regula "in cod" (X25519 din aplicatie nu se repara cu un gateway TLS)
// era verde in proba functiei si moarta pe drumul real (planul Avano avea tot 65 de actiuni "auto prin gateway")
api: g.api, language: g.language, protocolType: g.protocolType,
location: g.file ? `${g.file}:${g.line || '?'}` : undefined,
};
}
+33 -1
View File
@@ -27,6 +27,32 @@ const TINTE = {
pke: { target: 'ML-KEM-768 (hybrid KEM) instead of public-key encryption', product: 'kms', how: 'hybrid envelope through the KMS' },
};
// 2026-10-18 (prima rulare pe un arbore strain, Avano): un X25519, un Ed25519 sau un RSA chemat de APLICATIE (ratchet, PQXDH,
// ntor, semnaturi de mesaj, chei derivate) nu se repara punand un gateway TLS in fata serviciului si nici emitand un certificat:
// gateway-ul vede numai TLS-ul, PKI-ul numai certificatele. Numai o folosire de TLS/certificat din cod se trimite la produs; restul
// e lucru IN COD, manual, cu tinta hibrida scrisa. O constatare fara `api` (ECDH generic, fara context) ramane pe drumul vechi:
// contextul ei nu se stie, nu se ghiceste.
const IN_TLS = /\b(tls|ssl|https|x509|SSLContext|SslContext|ecdhCurve|CurvePreferences|namedGroups|KeyStore|keytool|rustls|SslConnector|SslAcceptor|TlsConnector|TlsAcceptor|HttpsConnectorBuilder)\b/i;
const TINTE_IN_COD = {
'key-agree': { target: 'X25519 + ML-KEM-768 in the same handshake and key schedule (hybrid KEM, as PQXDH does)', product: null,
how: 'called by the application itself, not by a TLS edge: a gateway in front cannot change it. Combine it with ML-KEM-768 in the protocol (both shared secrets into the KDF); if the protocol already pairs it with a post-quantum KEM in the same handshake, record that as the evidence and close this action.' },
};
// semnaturile si cifrarea cu cheie publica din cod raman pe PKI/KMS (produsul emite cheia hibrida, real, prin executor), dar `how`
// spune ca APLICATIA trebuie sa o adopte: produsul da cheia, nu schimba apelul din cod
const NOTA_ADOPTARE = {
signature: ' The application signs with its own key here, so after the PQ PKI issues the hybrid key and certificate the signing call must be changed to use them (a code change; the PKI provides the key, not the call site).',
pke: ' The application encrypts with its own public key here, so after the KMS holds the hybrid key the call must be changed to use the KMS envelope (a code change; the KMS provides the key, not the call site).',
};
// TLS de CLIENT configurat in aplicatie: gateway-ul (terminare de server) nu schimba ce ofera clientul; se repara in client
const TLS_CLIENT = /\b(default_provider|TlsConnector|ClientConfig|HttpsConnectorBuilder|SslConnector)\b/;
function tlsClientInCod(f) {
return !!(f.language && f.api) && TLS_CLIENT.test(String(f.api)) && f.assetType !== 'certificate' && f.assetType !== 'related-crypto-material';
}
function inCod(f) {
return !!(f.language && f.api) && !IN_TLS.test(String(f.api)) && f.protocolType !== 'tls'
&& f.assetType !== 'certificate' && f.assetType !== 'related-crypto-material';
}
// clasificarea unui asset vulnerabil in urgenta, pe natura primitivei (HNDL vs falsificare)
function urgenta(prim, expusPublic, certLunga) {
if (prim === 'key-agree' || prim === 'kem' || prim === 'pke') return expusPublic ? 'CRITICAL' : 'HIGH'; // HNDL: datele de azi se recolteaza
@@ -68,7 +94,13 @@ function actiuneDinInventar(f) {
const prim = primitivaDe(f);
const certLunga = f.assetType === 'certificate' && f.certificate && f.certificate.notValidAfter
&& (new Date(f.certificate.notValidAfter) - new Date()) > 365 * 24 * 3600 * 1000;
const t = TINTE[prim] || { target: 'hybrid post-quantum equivalent', product: null, how: 'to be decided' };
const eInCod = inCod(f);
const tInCod = (eInCod && TINTE_IN_COD[prim])
|| (tlsClientInCod(f) && (prim === 'key-agree' || prim === 'kem') && { target: 'X25519MLKEM768 offered by this client (hybrid)', product: null,
how: 'client-side TLS configured by the application itself: a PQ Gateway in front of a server does not change what this client offers. Switch the client to a provider that offers X25519MLKEM768 (rustls: aws-lc-rs, 0.23.22 or later; OpenSSL 3.5 or later) or enable the hybrid group in its configuration, then re-run the inventory.' });
const t0 = TINTE[prim] || { target: 'hybrid post-quantum equivalent', product: null, how: 'to be decided' };
const t = tInCod ? { ...tInCod, how: `${f.name || prim} via ${f.api}: ${tInCod.how}` }
: (eInCod && NOTA_ADOPTARE[prim] ? { ...t0, how: t0.how + NOTA_ADOPTARE[prim] } : t0);
const numeAsset = f.assetType === 'certificate'
? `X.509 certificate ${f.certificate && f.certificate.subjectName ? '(' + f.certificate.subjectName + ')' : ''}`.trim()
: `${f.name || prim}${f.assetType === 'related-crypto-material' && f.material ? ' (' + f.material.type + ')' : ''}`;
+3 -2
View File
@@ -38,8 +38,9 @@ try {
cer('dosar vulnerabil: 2 actiuni in plan', pv.summary.total === 2);
const ecdh = pv.actions.find((a) => /ECDH/i.test(a.name || a.asset));
const rsa = pv.actions.find((a) => /RSA/i.test(a.name || a.asset));
cer('ECDH -> gateway (schimb de cheie, auto)', ecdh && ecdh.product === 'gateway' && ecdh.method === 'auto-aere');
cer('RSA -> pki (semnatura, auto)', rsa && rsa.product === 'pki');
// 2026-10-18: createECDH e schimb de cheie facut de APLICATIE (api-ul si limbajul trec prin adaptor): manual, in cod, tinta hibrida, fara gateway
cer('ECDH din cod (createECDH) -> manual, in cod, tinta X25519 + ML-KEM-768, fara gateway', ecdh && ecdh.method === 'manual' && !ecdh.product && /ML-KEM-768/.test(ecdh.target) && /createECDH/.test(ecdh.how));
cer('RSA -> pki (semnatura, auto), cu nota ca aplicatia adopta cheia (schimbare de cod)', rsa && rsa.product === 'pki' && /code change/.test(rsa.how));
cer('HNDL: ECDH mai urgent decat RSA', ecdh && rsa && ({ CRITICAL: 0, HIGH: 1, MEDIUM: 2 }[ecdh.urgency] < { CRITICAL: 0, HIGH: 1, MEDIUM: 2 }[rsa.urgency]));
cer('fiecare actiune are locatia (fisier:linie)', pv.actions.every((a) => a.location && /\.js:\d/.test(a.location)));
+14
View File
@@ -19,6 +19,11 @@ const inventory = [
{ ref: 'algorithm:mlkem', assetType: 'algorithm', name: 'ML-KEM-768', primitive: 'kem', quantumVulnerable: false },
{ ref: 'algorithm:mldsa', assetType: 'algorithm', name: 'ML-DSA-65', primitive: 'signature', quantumVulnerable: false },
{ ref: 'algorithm:aes', assetType: 'algorithm', name: 'AES-256-GCM', primitive: 'ae', quantumVulnerable: false },
// 2026-10-18 (Avano): criptografie chemata de aplicatie, cu limbajul si API-ul din inventarul real; si un ECDH din configuratia TLS a codului
{ ref: 'cod:x25519:rust', assetType: 'algorithm', name: 'X25519', primitive: 'key-agree', quantumVulnerable: true, language: 'rust', api: 'StaticSecret::random_from_rng', location: 'src/ratchet.rs:10' },
{ ref: 'cod:ed25519:rust', assetType: 'algorithm', name: 'Ed25519', primitive: 'signature', quantumVulnerable: true, language: 'rust', api: 'SigningKey::generate', location: 'src/sign.rs:5' },
{ ref: 'cod:tls:go', assetType: 'algorithm', name: 'ECDH-secp256r1', primitive: 'key-agree', quantumVulnerable: true, language: 'go', api: 'tls.Config.CurvePreferences', protocolType: undefined, location: 'main.go:30' },
{ ref: 'cod:tls-client:rust', assetType: 'algorithm', name: 'X25519', primitive: 'key-agree', quantumVulnerable: true, language: 'rust', api: 'rustls::crypto::ring::default_provider', location: 'src/http.rs:12' },
];
// 2026-09-27: constatarile de scanare se DERIVA din sursa scanerului (readiness-service.mjs, apelurile lui add(id, severitate,
// titlu)), nu se scriu de mana. Fixtura veche folosea id-uri inventate ('tls-kex-classical', 'tls12-enabled'), deci proba era verde
@@ -49,6 +54,15 @@ cer('certificatul WebPKI public e BLOCAT (niciun CA public PQ), nu se pretinde a
cer('scanarea: schimbul de cheie clasic e in plan, auto prin gateway', byRef['tls-kex:client.exemplu.com'] && byRef['tls-kex:client.exemplu.com'].product === 'gateway');
cer('scanarea: TLS 1.2 e in plan, manual (config)', byRef['tls-conf:client.exemplu.com:tls12-accepted'] && byRef['tls-conf:client.exemplu.com:tls12-accepted'].method === 'manual');
// 2026-10-18 (Avano): criptografia chemata de aplicatie nu se repara cu gateway-ul sau cu PKI-ul; cea din configuratia TLS, da
const xc = byRef['cod:x25519:rust'], ec = byRef['cod:ed25519:rust'], tc = byRef['cod:tls:go'];
cer('X25519 chemat din cod (ratchet) -> manual, in cod, tinta hibrida cu ML-KEM-768, fara gateway', xc && xc.method === 'manual' && !xc.product && /ML-KEM-768/.test(xc.target) && /gateway in front cannot/.test(xc.how) && /StaticSecret/.test(xc.how));
cer('Ed25519 pe date de aplicatie -> PKI emite cheia hibrida, iar how spune ca aplicatia trebuie sa o adopte (schimbare de cod)', ec && ec.product === 'pki' && /ML-DSA/.test(ec.target) && /code change/.test(ec.how) && /call site/.test(ec.how));
cer('CONTROL: ECDH din configuratia TLS a codului ramane auto prin gateway', tc && tc.product === 'gateway' && tc.method === 'auto-aere');
cer('HNDL ramane si in cod: X25519 HIGH, Ed25519 MEDIUM', xc && ec && xc.urgency === 'HIGH' && ec.urgency === 'MEDIUM');
const cl = byRef['cod:tls-client:rust'];
cer('TLS de client din cod (rustls ring provider) -> manual, furnizorul hibrid in client, fara gateway', cl && cl.method === 'manual' && !cl.product && /X25519MLKEM768/.test(cl.target) && /aws-lc-rs/.test(cl.how) && /does not change what this client offers/.test(cl.how));
// controale negative: ce NU trebuie sa fie in plan
cer('CONTROL: ML-KEM (deja PQ) NU e in plan', !byRef['algorithm:mlkem']);
cer('CONTROL: ML-DSA (deja PQ) NU e in plan', !byRef['algorithm:mldsa']);