@quantakrypto/core 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cbom-merge.d.ts +9 -0
- package/dist/cbom-merge.d.ts.map +1 -0
- package/dist/cbom-merge.js +99 -0
- package/dist/cbom-merge.js.map +1 -0
- package/dist/comments.d.ts +4 -3
- package/dist/comments.d.ts.map +1 -1
- package/dist/comments.js +53 -33
- package/dist/comments.js.map +1 -1
- package/dist/dependencies.d.ts.map +1 -1
- package/dist/dependencies.js +1 -1
- package/dist/dependencies.js.map +1 -1
- package/dist/detect-utils.d.ts +5 -1
- package/dist/detect-utils.d.ts.map +1 -1
- package/dist/detect-utils.js +11 -2
- package/dist/detect-utils.js.map +1 -1
- package/dist/detectors/c.d.ts +4 -2
- package/dist/detectors/c.d.ts.map +1 -1
- package/dist/detectors/c.js +192 -1
- package/dist/detectors/c.js.map +1 -1
- package/dist/detectors/cicd.d.ts +27 -0
- package/dist/detectors/cicd.d.ts.map +1 -0
- package/dist/detectors/cicd.js +116 -0
- package/dist/detectors/cicd.js.map +1 -0
- package/dist/detectors/cloud-kms.d.ts +21 -0
- package/dist/detectors/cloud-kms.d.ts.map +1 -0
- package/dist/detectors/cloud-kms.js +57 -0
- package/dist/detectors/cloud-kms.js.map +1 -0
- package/dist/detectors/cloudformation.d.ts +30 -0
- package/dist/detectors/cloudformation.d.ts.map +1 -0
- package/dist/detectors/cloudformation.js +170 -0
- package/dist/detectors/cloudformation.js.map +1 -0
- package/dist/detectors/database.d.ts +17 -0
- package/dist/detectors/database.d.ts.map +1 -0
- package/dist/detectors/database.js +60 -0
- package/dist/detectors/database.js.map +1 -0
- package/dist/detectors/dnssec.d.ts +55 -0
- package/dist/detectors/dnssec.d.ts.map +1 -0
- package/dist/detectors/dnssec.js +107 -0
- package/dist/detectors/dnssec.js.map +1 -0
- package/dist/detectors/elixir.d.ts +20 -0
- package/dist/detectors/elixir.d.ts.map +1 -0
- package/dist/detectors/elixir.js +195 -0
- package/dist/detectors/elixir.js.map +1 -0
- package/dist/detectors/java.d.ts.map +1 -1
- package/dist/detectors/java.js +1 -1
- package/dist/detectors/java.js.map +1 -1
- package/dist/detectors/jose.d.ts +20 -0
- package/dist/detectors/jose.d.ts.map +1 -0
- package/dist/detectors/jose.js +62 -0
- package/dist/detectors/jose.js.map +1 -0
- package/dist/detectors/jwk.d.ts +25 -0
- package/dist/detectors/jwk.d.ts.map +1 -0
- package/dist/detectors/jwk.js +95 -0
- package/dist/detectors/jwk.js.map +1 -0
- package/dist/detectors/k8s.d.ts +17 -0
- package/dist/detectors/k8s.d.ts.map +1 -0
- package/dist/detectors/k8s.js +85 -0
- package/dist/detectors/k8s.js.map +1 -0
- package/dist/detectors/mesh.d.ts +35 -0
- package/dist/detectors/mesh.d.ts.map +1 -0
- package/dist/detectors/mesh.js +109 -0
- package/dist/detectors/mesh.js.map +1 -0
- package/dist/detectors/messaging.d.ts +16 -0
- package/dist/detectors/messaging.d.ts.map +1 -0
- package/dist/detectors/messaging.js +72 -0
- package/dist/detectors/messaging.js.map +1 -0
- package/dist/detectors/pem.js +1 -1
- package/dist/detectors/pem.js.map +1 -1
- package/dist/detectors/php.d.ts +24 -0
- package/dist/detectors/php.d.ts.map +1 -0
- package/dist/detectors/php.js +167 -0
- package/dist/detectors/php.js.map +1 -0
- package/dist/detectors/python.d.ts.map +1 -1
- package/dist/detectors/python.js +70 -0
- package/dist/detectors/python.js.map +1 -1
- package/dist/detectors/rust.d.ts.map +1 -1
- package/dist/detectors/rust.js +68 -0
- package/dist/detectors/rust.js.map +1 -1
- package/dist/detectors/secrets.d.ts +21 -0
- package/dist/detectors/secrets.d.ts.map +1 -0
- package/dist/detectors/secrets.js +79 -0
- package/dist/detectors/secrets.js.map +1 -0
- package/dist/detectors/source.d.ts.map +1 -1
- package/dist/detectors/source.js +190 -47
- package/dist/detectors/source.js.map +1 -1
- package/dist/detectors/stateful-hbs.d.ts.map +1 -1
- package/dist/detectors/stateful-hbs.js +9 -6
- package/dist/detectors/stateful-hbs.js.map +1 -1
- package/dist/detectors/terraform.d.ts +21 -0
- package/dist/detectors/terraform.d.ts.map +1 -0
- package/dist/detectors/terraform.js +123 -0
- package/dist/detectors/terraform.js.map +1 -0
- package/dist/detectors/vpn.d.ts +22 -0
- package/dist/detectors/vpn.d.ts.map +1 -0
- package/dist/detectors/vpn.js +99 -0
- package/dist/detectors/vpn.js.map +1 -0
- package/dist/evidence.d.ts +5 -0
- package/dist/evidence.d.ts.map +1 -1
- package/dist/evidence.js +5 -0
- package/dist/evidence.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/policy.d.ts +67 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +115 -0
- package/dist/policy.js.map +1 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +30 -0
- package/dist/registry.js.map +1 -1
- package/dist/remediate-pipeline.d.ts.map +1 -1
- package/dist/remediate-pipeline.js +22 -1
- package/dist/remediate-pipeline.js.map +1 -1
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +7 -0
- package/dist/report.js.map +1 -1
- package/dist/standards.d.ts +96 -0
- package/dist/standards.d.ts.map +1 -0
- package/dist/standards.js +107 -0
- package/dist/standards.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/src/cbom-merge.ts +116 -0
- package/src/comments.ts +59 -33
- package/src/dependencies.ts +2 -1
- package/src/detect-utils.ts +14 -2
- package/src/detectors/c.ts +209 -3
- package/src/detectors/cicd.ts +158 -0
- package/src/detectors/cloud-kms.ts +87 -0
- package/src/detectors/cloudformation.ts +215 -0
- package/src/detectors/database.ts +88 -0
- package/src/detectors/dnssec.ts +186 -0
- package/src/detectors/elixir.ts +237 -0
- package/src/detectors/java.ts +2 -1
- package/src/detectors/jose.ts +94 -0
- package/src/detectors/jwk.ts +128 -0
- package/src/detectors/k8s.ts +112 -0
- package/src/detectors/mesh.ts +154 -0
- package/src/detectors/messaging.ts +98 -0
- package/src/detectors/pem.ts +1 -1
- package/src/detectors/php.ts +225 -0
- package/src/detectors/python.ts +71 -0
- package/src/detectors/rust.ts +71 -0
- package/src/detectors/secrets.ts +114 -0
- package/src/detectors/source.ts +235 -68
- package/src/detectors/stateful-hbs.ts +9 -6
- package/src/detectors/terraform.ts +154 -0
- package/src/detectors/vpn.ts +131 -0
- package/src/evidence.ts +11 -0
- package/src/index.ts +10 -0
- package/src/policy.ts +180 -0
- package/src/registry.ts +30 -0
- package/src/remediate-pipeline.ts +25 -2
- package/src/report.ts +7 -0
- package/src/standards.ts +186 -0
- package/src/types.ts +2 -0
- package/src/version.ts +1 -1
package/dist/dependencies.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../src/dependencies.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAa;IAC3C,EAAE,EAAE,gBAAgB;IACpB,KAAK,EAAE,+BAA+B;IACtC,QAAQ,EAAE,YAAY;IACtB,+EAA+E;IAC/E,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,iBAAiB;IACtB,OAAO,EACL,8EAA8E;QAC9E,yEAAyE;IAC3E,WAAW,EACT,8EAA8E;QAC9E,2EAA2E;IAC7E,WAA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CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI;QAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IACtE,wEAAwE;IACxE,MAAM,KAAK,GAAG,4DAA4D,CAAC;IAC3E,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI;QAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CACtB,OAAe,EACf,IAAY,EACZ,EAAqC;IAErC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAgC,CAAC;IACtD,KAAK,MAAM,IAAI,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QAClD,MAAM,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,GAAG;YAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QACjC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["/**\n * Curated database of packages that primarily expose classical asymmetric\n * cryptography (and are therefore quantum-vulnerable), across multiple\n * ecosystems (npm, PyPI, crates.io, Go modules, Maven, RubyGems, NuGet), plus a\n * manifest scanner that flags any of them found in the corresponding manifest\n * (package.json, requirements.txt, Cargo.toml, go.mod, pom.xml, Gemfile,\n * packages.config / *.csproj, …).\n *\n * The list is intentionally focused on libraries whose *purpose* is classical\n * public-key crypto. General-purpose packages that merely call the language's\n * stdlib crypto are out of scope here (those are caught by the source detectors).\n * Extraction is generous but every finding must match a curated entry, so a new\n * manifest format is cheap to add (see `manifestEcosystem` + `candidateNames`).\n */\nimport type {\n AlgorithmFamily,\n DependencyEcosystem,\n Finding,\n RuleMeta,\n VulnerableDependency,\n} from \"./types.js\";\nimport { makeFinding } from \"./detect-utils.js\";\nimport { isConfidentialityFamily, isSignatureFamily, remediationText } from \"./remediation.js\";\nimport { CWE_BROKEN_CRYPTO } from \"./cwe.js\";\n\n/**\n * Catalog entry for the `dep-vulnerable` rule. Dependency findings are produced\n * by the manifest scanner rather than a registered {@link Detector}, so this\n * rule is absent from `defaultRegistry.ruleCatalog()`. Reporters (SARIF) merge\n * it in so the rule advertises a GENERIC description — the per-package specifics\n * (title/severity/HNDL/remediation) live on each individual finding/result, not\n * on the shared rule. Without this, SARIF would leak the first dependency's\n * package-specific text into the rule-level `shortDescription` for every dep.\n */\nexport const DEP_VULNERABLE_RULE: RuleMeta = {\n id: \"dep-vulnerable\",\n title: \"Quantum-vulnerable dependency\",\n category: \"dependency\",\n // Representative default; each SARIF result carries its own per-package level.\n severity: \"high\",\n confidence: \"high\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"A dependency implements classical public-key cryptography that is broken by \" +\n \"quantum computers. Replace or upgrade it to a post-quantum alternative.\",\n remediation:\n \"Move to a post-quantum alternative — ML-KEM-768 (FIPS 203) for key exchange/\" +\n \"encryption and ML-DSA-65 (FIPS 204) for signatures, ideally via a hybrid.\",\n description:\n \"Flags packages in a dependency manifest known to implement quantum-vulnerable \" +\n \"public-key cryptography (RSA, ECDH/ECDSA, DH, EdDSA, …).\",\n};\n\n/** Known quantum-vulnerable npm dependencies. */\nexport const vulnerableDependencies: VulnerableDependency[] = [\n {\n name: \"node-forge\",\n ecosystem: \"npm\",\n reason: \"Pure-JS implementation of RSA, RSA-OAEP, and X.509 PKI.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"elliptic\",\n ecosystem: \"npm\",\n reason: \"Elliptic-curve ECDSA/ECDH (secp256k1, p256, ed25519).\",\n algorithms: [\"ECDSA\", \"ECDH\", \"EdDSA\"],\n severity: \"high\",\n },\n {\n name: \"jsrsasign\",\n ecosystem: \"npm\",\n reason: \"RSA/ECDSA/DSA signing, JWT, and X.509 in pure JS.\",\n algorithms: [\"RSA\", \"ECDSA\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"node-rsa\",\n ecosystem: \"npm\",\n reason: \"Classical RSA encryption and signing.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"ursa\",\n ecosystem: \"npm\",\n reason: \"OpenSSL-backed RSA encryption and signing bindings.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"sshpk\",\n ecosystem: \"npm\",\n reason: \"Parses/handles SSH and PEM keys (RSA, ECDSA, Ed25519, DSA).\",\n algorithms: [\"RSA\", \"ECDSA\", \"EdDSA\", \"DSA\"],\n severity: \"medium\",\n },\n {\n name: \"jsonwebtoken\",\n ecosystem: \"npm\",\n reason: \"JWTs commonly signed with RS256/ES256 (classical RSA/ECDSA).\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"high\",\n hndl: false,\n },\n {\n name: \"jose\",\n ecosystem: \"npm\",\n reason: \"JWS/JWE with classical RSA-OAEP, RSA-PSS, ECDH-ES and ECDSA.\",\n algorithms: [\"RSA\", \"ECDH\", \"ECDSA\", \"EdDSA\"],\n severity: \"high\",\n },\n {\n name: \"jws\",\n ecosystem: \"npm\",\n reason: \"JSON Web Signatures using classical RS/ES algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"high\",\n hndl: false,\n },\n {\n name: \"eccrypto\",\n ecosystem: \"npm\",\n reason: \"ECIES (ECDH-based) encryption and ECDSA signatures.\",\n algorithms: [\"ECIES\", \"ECDH\", \"ECDSA\"],\n severity: \"high\",\n },\n {\n name: \"secp256k1\",\n ecosystem: \"npm\",\n reason: \"secp256k1 ECDSA/ECDH bindings (blockchain keys).\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"tweetnacl\",\n ecosystem: \"npm\",\n reason: \"X25519 key exchange and Ed25519 signatures (modern but classical).\",\n algorithms: [\"X25519\", \"EdDSA\"],\n severity: \"low\",\n },\n {\n name: \"ed25519\",\n ecosystem: \"npm\",\n reason: \"Ed25519 signatures (classical).\",\n algorithms: [\"EdDSA\"],\n severity: \"low\",\n },\n {\n name: \"@noble/curves\",\n ecosystem: \"npm\",\n reason: \"Audited classical curves: ECDSA, ECDH, Ed25519, X25519, secp256k1.\",\n algorithms: [\"ECDSA\", \"ECDH\", \"EdDSA\", \"X25519\"],\n severity: \"medium\",\n },\n {\n name: \"@noble/secp256k1\",\n ecosystem: \"npm\",\n reason: \"secp256k1 ECDSA/ECDH (classical).\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"@noble/ed25519\",\n ecosystem: \"npm\",\n reason: \"Ed25519 signatures and X25519 key exchange (classical).\",\n algorithms: [\"EdDSA\", \"X25519\"],\n severity: \"low\",\n },\n {\n name: \"paseto\",\n ecosystem: \"npm\",\n reason: \"PASETO public tokens signed with classical Ed25519 (v2/v4) or RSA.\",\n algorithms: [\"EdDSA\", \"RSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"bcrypto\",\n ecosystem: \"npm\",\n reason: \"Broad classical crypto suite: RSA, ECDSA, ECDH, Ed25519, DSA.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"EdDSA\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"ecpair\",\n ecosystem: \"npm\",\n reason: \"secp256k1 ECDSA key pairs for Bitcoin.\",\n algorithms: [\"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"keypair\",\n ecosystem: \"npm\",\n reason: \"Pure-JS RSA key pair generation.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"ethers\",\n ecosystem: \"npm\",\n reason: \"Ethereum library built on secp256k1 ECDSA signing and key derivation.\",\n algorithms: [\"ECDSA\"],\n severity: \"high\",\n },\n {\n name: \"web3\",\n ecosystem: \"npm\",\n reason: \"Ethereum library using secp256k1 ECDSA for accounts and signing.\",\n algorithms: [\"ECDSA\"],\n severity: \"high\",\n },\n {\n name: \"bitcoinjs-lib\",\n ecosystem: \"npm\",\n reason: \"Bitcoin library built on secp256k1 ECDSA/Schnorr keys and signatures.\",\n algorithms: [\"ECDSA\"],\n severity: \"high\",\n },\n {\n name: \"ethereumjs-util\",\n ecosystem: \"npm\",\n reason: \"secp256k1 ECDSA utilities for Ethereum keys and signatures.\",\n algorithms: [\"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"openpgp\",\n ecosystem: \"npm\",\n reason: \"OpenPGP.js: RSA, ECDSA, ECDH, and EdDSA public-key crypto.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"EdDSA\"],\n severity: \"high\",\n },\n {\n name: \"node-jose\",\n ecosystem: \"npm\",\n reason: \"JOSE (JWS/JWE/JWK) with classical RSA and EC algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"jwa\",\n ecosystem: \"npm\",\n reason: \"JSON Web Algorithms: RSA (RS/PS) and EC (ES) signatures.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"jwk-to-pem\",\n ecosystem: \"npm\",\n reason: \"Converts RSA/EC JWKs to PEM — classical public keys.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"fast-jwt\",\n ecosystem: \"npm\",\n reason: \"JWT signing/verification with classical RS/PS/ES algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"ssh2\",\n ecosystem: \"npm\",\n reason: \"SSH client/server using classical RSA/ECDSA/Ed25519 host and user keys.\",\n algorithms: [\"RSA\", \"ECDSA\", \"EdDSA\"],\n severity: \"high\",\n },\n {\n name: \"@peculiar/x509\",\n ecosystem: \"npm\",\n reason: \"X.509 certificate library over classical RSA/EC keys.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"pkijs\",\n ecosystem: \"npm\",\n reason: \"PKI (X.509/CMS) built on classical RSA and EC public-key crypto.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"http-signature\",\n ecosystem: \"npm\",\n reason: \"HTTP request signing with classical RSA/ECDSA keys.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"libsodium-wrappers\",\n ecosystem: \"npm\",\n reason: \"libsodium: Ed25519 signatures and X25519 key exchange (classical).\",\n algorithms: [\"EdDSA\", \"X25519\"],\n severity: \"medium\",\n },\n {\n name: \"ecdsa-sig-formatter\",\n ecosystem: \"npm\",\n reason: \"Formats ECDSA signatures — a marker of classical EC signing.\",\n algorithms: [\"ECDSA\"],\n severity: \"low\",\n },\n\n // --- PyPI (Python) ---\n {\n name: \"pycryptodome\",\n ecosystem: \"pypi\",\n reason: \"RSA / ECC / DSA public-key crypto for Python.\",\n algorithms: [\"RSA\", \"ECDSA\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"pycrypto\",\n ecosystem: \"pypi\",\n reason: \"Abandoned/unmaintained crypto library — classical RSA/DSA/ElGamal.\",\n algorithms: [\"RSA\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"jwcrypto\",\n ecosystem: \"pypi\",\n reason: \"JWK / JWS / JWE with classical RS*/ES* and ECDH-ES key agreement.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"authlib\",\n ecosystem: \"pypi\",\n reason: \"OAuth / OIDC / JOSE stack using classical RS*/ES* JWT signing.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"pycryptodomex\",\n ecosystem: \"pypi\",\n reason: \"RSA / ECC / DSA public-key crypto (the `Cryptodome` namespace).\",\n algorithms: [\"RSA\", \"ECDSA\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"rsa\",\n ecosystem: \"pypi\",\n reason: \"Pure-Python RSA encryption and signing.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"ecdsa\",\n ecosystem: \"pypi\",\n reason: \"Pure-Python ECDSA/ECDH over NIST + secp256k1 curves.\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"cryptography\",\n ecosystem: \"pypi\",\n reason: \"General crypto library exposing classical RSA/EC/DH/DSA (also symmetric/PQC).\",\n algorithms: [\"RSA\", \"ECDH\", \"ECDSA\", \"DSA\"],\n severity: \"medium\",\n },\n {\n name: \"pyjwt\",\n ecosystem: \"pypi\",\n reason: \"JWT signing with classical RS*/ES* algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"python-jose\",\n ecosystem: \"pypi\",\n reason: \"JOSE/JWT with classical RSA/ECDSA algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"paramiko\",\n ecosystem: \"pypi\",\n reason: \"SSH client/server with classical RSA/ECDSA/Ed25519/DSA host + user keys.\",\n algorithms: [\"RSA\", \"ECDSA\", \"EdDSA\", \"DSA\"],\n severity: \"medium\",\n },\n {\n name: \"pyopenssl\",\n ecosystem: \"pypi\",\n reason: \"OpenSSL bindings for classical RSA/EC X.509 + TLS.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"pynacl\",\n ecosystem: \"pypi\",\n reason:\n \"libsodium bindings — X25519 key agreement and Ed25519 signatures (modern but classical).\",\n algorithms: [\"X25519\", \"EdDSA\"],\n severity: \"low\",\n },\n\n // --- crates.io (Rust) ---\n {\n name: \"rsa\",\n ecosystem: \"cargo\",\n reason: \"Pure-Rust RSA encryption and signing.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"ring\",\n ecosystem: \"cargo\",\n reason: \"RSA / ECDSA / Ed25519 / ECDH primitives.\",\n algorithms: [\"RSA\", \"ECDSA\", \"EdDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"openssl\",\n ecosystem: \"cargo\",\n reason: \"OpenSSL bindings for classical RSA/EC crypto.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"p256\",\n ecosystem: \"cargo\",\n reason: \"NIST P-256 ECDSA signatures and ECDH key agreement.\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"p384\",\n ecosystem: \"cargo\",\n reason: \"NIST P-384 ECDSA signatures and ECDH key agreement.\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"k256\",\n ecosystem: \"cargo\",\n reason: \"secp256k1 ECDSA signatures and ECDH key agreement.\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"secp256k1\",\n ecosystem: \"cargo\",\n reason: \"libsecp256k1 bindings (blockchain) — classical ECDSA + ECDH.\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"ed25519-dalek\",\n ecosystem: \"cargo\",\n reason: \"Ed25519 signatures (modern but classical).\",\n algorithms: [\"EdDSA\"],\n severity: \"low\",\n },\n {\n name: \"x25519-dalek\",\n ecosystem: \"cargo\",\n reason: \"X25519 key agreement (modern but classical).\",\n algorithms: [\"X25519\"],\n severity: \"low\",\n },\n\n // --- Go modules ---\n {\n name: \"golang.org/x/crypto\",\n ecosystem: \"go\",\n reason: \"SSH, OpenPGP, and classical curve helpers on top of the Go stdlib.\",\n algorithms: [\"RSA\", \"ECDSA\", \"EdDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"github.com/golang-jwt/jwt/v5\",\n ecosystem: \"go\",\n reason: \"golang-jwt — classical RS*/PS*/ES* JWT algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"github.com/golang-jwt/jwt/v4\",\n ecosystem: \"go\",\n reason: \"golang-jwt (v4) — classical RS*/PS*/ES* JWT algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"github.com/go-jose/go-jose/v4\",\n ecosystem: \"go\",\n reason: \"go-jose — classical JOSE (RSA/ECDSA signatures, ECDH-ES key agreement).\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"github.com/cloudflare/circl\",\n ecosystem: \"go\",\n reason: \"Cloudflare CIRCL — classical ECDH/EdDSA curves (X25519, X448, Ed25519, P-256).\",\n algorithms: [\"ECDH\", \"EdDSA\"],\n severity: \"medium\",\n },\n {\n name: \"github.com/decred/dcrd/dcrec/secp256k1/v4\",\n ecosystem: \"go\",\n reason: \"decred secp256k1 — classical ECDSA/ECDH on the secp256k1 curve (blockchain keys).\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n\n // --- Maven (Java) ---\n {\n name: \"bcprov-jdk18on\",\n ecosystem: \"maven\",\n reason: \"BouncyCastle provider — full classical RSA/ECDSA/ECDH/DSA suite.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"bcprov-jdk15on\",\n ecosystem: \"maven\",\n reason: \"BouncyCastle provider (JDK 1.5+) — classical RSA/ECDSA/ECDH/DSA.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"bcpkix-jdk18on\",\n ecosystem: \"maven\",\n reason: \"BouncyCastle PKIX — classical X.509 / CMS with RSA/ECDSA.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"java-jwt\",\n ecosystem: \"maven\",\n reason: \"Auth0 JWT with classical RS*/ES* algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"nimbus-jose-jwt\",\n ecosystem: \"maven\",\n reason: \"Nimbus JOSE+JWT — classical RS*/PS*/ES* JWS and RSA/ECDH-ES JWE.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"jjwt-api\",\n ecosystem: \"maven\",\n reason: \"JJWT (io.jsonwebtoken) — classical RS*/ES* JWT signing.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n\n // --- RubyGems ---\n {\n name: \"jwt\",\n ecosystem: \"rubygems\",\n reason: \"Ruby JWT with classical RS*/ES* algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"net-ssh\",\n ecosystem: \"rubygems\",\n reason:\n \"Ruby SSH client — classical host/user keys (RSA/ECDSA/Ed25519) and ECDH/DH key exchange.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"rbnacl\",\n ecosystem: \"rubygems\",\n reason: \"libsodium bindings — X25519 key agreement and Ed25519 signatures.\",\n algorithms: [\"X25519\", \"EdDSA\"],\n severity: \"low\",\n },\n {\n name: \"ed25519\",\n ecosystem: \"rubygems\",\n reason: \"Ed25519 signatures (modern but classical).\",\n algorithms: [\"EdDSA\"],\n severity: \"low\",\n },\n\n // --- NuGet (.NET) ---\n {\n name: \"BouncyCastle.Cryptography\",\n ecosystem: \"nuget\",\n reason: \"BouncyCastle for .NET — full classical RSA/ECDSA/ECDH/DSA suite.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"Portable.BouncyCastle\",\n ecosystem: \"nuget\",\n reason: \"Portable BouncyCastle for .NET — classical RSA/ECDSA/ECDH/DSA.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"System.IdentityModel.Tokens.Jwt\",\n ecosystem: \"nuget\",\n reason: \"Microsoft JWT handler — classical RS*/ES* (RSA/ECDSA) signatures.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"Microsoft.IdentityModel.Tokens\",\n ecosystem: \"nuget\",\n reason: \"Microsoft IdentityModel token crypto — classical RSA/ECDSA keys.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n];\n\n/**\n * Normalise a package name for matching within its ecosystem. PyPI is\n * case-insensitive and folds runs of `-_.` to a single `-` (PEP 503); cargo /\n * maven / rubygems / nuget are effectively lower-case (NuGet ids are matched\n * case-insensitively); npm and go module paths are matched verbatim (npm scopes\n * and go paths are case-sensitive).\n */\nfunction normalizeName(ecosystem: DependencyEcosystem, name: string): string {\n const n = name.trim();\n if (ecosystem === \"pypi\") return n.toLowerCase().replace(/[-_.]+/g, \"-\");\n if (ecosystem === \"npm\" || ecosystem === \"go\") return n;\n return n.toLowerCase();\n}\n\n/** ecosystem → (normalised name → entry). Scoped so `rsa` (pypi) ≠ `rsa` (cargo). */\nconst BY_ECOSYSTEM: Map<DependencyEcosystem, Map<string, VulnerableDependency>> = (() => {\n const m = new Map<DependencyEcosystem, Map<string, VulnerableDependency>>();\n for (const d of vulnerableDependencies) {\n let em = m.get(d.ecosystem);\n if (!em) {\n em = new Map();\n m.set(d.ecosystem, em);\n }\n em.set(normalizeName(d.ecosystem, d.name), d);\n }\n return m;\n})();\n\n/**\n * Precompiled `\"name\":` lookup regex per known npm package (P1-9): the set is\n * static, so build the (name → RegExp) map once rather than per manifest. Only\n * npm uses the JSON-key form; other ecosystems locate names generically.\n */\nconst KEY_REGEX_BY_NAME = new Map<string, RegExp>(\n vulnerableDependencies\n .filter((d) => d.ecosystem === \"npm\")\n .map((d): [string, RegExp] => {\n const escaped = d.name.replace(/[.*+?^${}()|[\\]\\\\/]/g, \"\\\\$&\");\n return [d.name, new RegExp(`\"${escaped}\"\\\\s*:`)];\n }),\n);\n\n/**\n * Build a remediation string covering ALL families a package exposes (C5),\n * rather than only `algorithms[0]`. De-duplicates by PQC *target* — the KEM\n * target and the signature target are each named at most once — so a library\n * exposing both a confidentiality family and a signature family reads\n * \"ML-KEM-768 … for key exchange/encryption; ML-DSA-65 (FIPS 204) for\n * signatures\" instead of repeating ML-DSA (the old per-string Set couldn't\n * collapse \"ML-DSA-65 for signatures\" against a standalone \"ML-DSA-65 (FIPS 204)\").\n */\nfunction multiFamilyRemediation(algorithms: readonly AlgorithmFamily[]): string {\n let needsKem = false;\n let needsSig = false;\n let needsReview = false;\n for (const a of algorithms) {\n if (isConfidentialityFamily(a)) needsKem = true;\n if (isSignatureFamily(a)) needsSig = true;\n if (a === \"unknown\") needsReview = true;\n }\n const parts: string[] = [];\n if (needsKem)\n parts.push(\"ML-KEM-768 (FIPS 203, hybrid X25519MLKEM768) for key exchange/encryption\");\n if (needsSig) parts.push(\"ML-DSA-65 (FIPS 204) for signatures\");\n // Only fall back to the generic \"review\" line when nothing concrete applied.\n if (needsReview && parts.length === 0) parts.push(remediationText(\"unknown\"));\n return parts.join(\"; \");\n}\n\n/**\n * The dependency ecosystem a manifest filename belongs to, or null when the file\n * is not a manifest we parse. Drives both {@link isManifestFile} and the scanner\n * dispatch — one place to add a manifest format.\n */\nexport function manifestEcosystem(file: string): DependencyEcosystem | null {\n const base = (file.split(\"/\").pop() ?? file).toLowerCase();\n if (\n base === \"package.json\" ||\n base === \"package-lock.json\" ||\n base === \"npm-shrinkwrap.json\" ||\n base === \"yarn.lock\" ||\n base === \"pnpm-lock.yaml\"\n ) {\n return \"npm\";\n }\n if (base === \"requirements.txt\" || /^requirements[\\w.-]*\\.txt$/.test(base)) return \"pypi\";\n if (base === \"pyproject.toml\" || base === \"pipfile\") return \"pypi\";\n if (base === \"cargo.toml\") return \"cargo\";\n if (base === \"go.mod\") return \"go\";\n if (base === \"pom.xml\" || base === \"build.gradle\" || base === \"build.gradle.kts\") return \"maven\";\n if (base === \"gemfile\" || base.endsWith(\".gemspec\")) return \"rubygems\";\n if (base === \"packages.config\" || base === \"directory.packages.props\" || base.endsWith(\".csproj\"))\n return \"nuget\";\n return null;\n}\n\n/** True if a file path looks like a manifest we can parse for dependencies. */\nexport function isManifestFile(file: string): boolean {\n return manifestEcosystem(file) !== null;\n}\n\n/**\n * Extract candidate package names from a non-npm manifest. Extraction is\n * deliberately GENEROUS — every finding still has to match a curated DB entry,\n * so over-extracting harmless tokens (e.g. a TOML `version = …` key) costs\n * nothing while keeping the parsers tiny and format-tolerant.\n */\nfunction candidateNames(ecosystem: DependencyEcosystem, content: string): string[] {\n const names: string[] = [];\n const lines = content.split(\"\\n\");\n switch (ecosystem) {\n case \"pypi\": {\n // requirements.txt / Pipfile / pyproject.toml: leading token per line, plus\n // quoted deps in arrays/tables. Skip comments and `-r/-e/--flag` lines.\n for (const raw of lines) {\n const line = raw.trim();\n if (!line || line.startsWith(\"#\") || line.startsWith(\"-\")) continue;\n const lead = /^[\"']?([A-Za-z][A-Za-z0-9._-]+)/.exec(line);\n if (lead) names.push(lead[1]);\n for (const m of line.matchAll(/[\"']([A-Za-z][A-Za-z0-9._-]+)/g)) names.push(m[1]);\n }\n break;\n }\n case \"cargo\": {\n // Cargo.toml: dependency-table keys `name = …` and `[…dependencies.name]`.\n for (const raw of lines) {\n const line = raw.trim();\n if (!line || line.startsWith(\"#\")) continue;\n const key = /^([A-Za-z0-9][A-Za-z0-9_-]+)\\s*=/.exec(line);\n if (key) names.push(key[1]);\n const table = /^\\[[\\w.-]*dependencies\\.([A-Za-z0-9][A-Za-z0-9_-]+)\\]/.exec(line);\n if (table) names.push(table[1]);\n }\n break;\n }\n case \"go\": {\n // go.mod: `require path v1.2.3` (single or in a require( … ) block).\n for (const m of content.matchAll(/(?:^|\\s)([a-z0-9][\\w.\\-/]+)\\s+v\\d/gm)) names.push(m[1]);\n break;\n }\n case \"maven\": {\n // pom.xml <artifactId> tags + gradle `group:artifact:version` strings.\n for (const m of content.matchAll(/<artifactId>\\s*([\\w.-]+)\\s*<\\/artifactId>/g)) {\n names.push(m[1]);\n }\n for (const m of content.matchAll(/[\"']([\\w.-]+):([\\w.-]+):[\\w.$-]+[\"']/g)) names.push(m[2]);\n break;\n }\n case \"rubygems\": {\n // Gemfile `gem 'name'` + gemspec `add_*dependency 'name'`.\n for (const m of content.matchAll(/\\bgem\\s+[\"']([\\w.-]+)[\"']/g)) names.push(m[1]);\n for (const m of content.matchAll(\n /add(?:_runtime|_development)?_dependency\\s+[\"']([\\w.-]+)[\"']/g,\n )) {\n names.push(m[1]);\n }\n break;\n }\n case \"nuget\": {\n // NuGet manifests are XML. `.csproj` / `Directory.Packages.props` declare\n // `<PackageReference Include=\"Name\" … />`; `packages.config` uses\n // `<package id=\"Name\" … />`. Pull the Include= / id= attribute value from\n // each. The `[^>]` guard keeps every match inside a single tag, so the\n // scan is linear (no nested quantifiers → no catastrophic backtracking).\n for (const m of content.matchAll(/<PackageReference\\b[^>]*\\bInclude\\s*=\\s*\"([^\"]+)\"/gi)) {\n names.push(m[1]);\n }\n for (const m of content.matchAll(/<package\\b[^>]*\\bid\\s*=\\s*\"([^\"]+)\"/gi)) {\n names.push(m[1]);\n }\n break;\n }\n case \"npm\":\n break; // npm uses the JSON path, not this extractor.\n }\n return names;\n}\n\n/** First offset of a package `name` as a whole token in the manifest text (or 0). */\nfunction offsetOfName(content: string, name: string): number {\n const escaped = name.replace(/[.*+?^${}()|[\\]\\\\/]/g, \"\\\\$&\");\n const m = new RegExp(`(?<![\\\\w./-])${escaped}(?![\\\\w-])`).exec(content);\n return m ? m.index : 0;\n}\n\n/**\n * Build a finding for a vulnerable dependency located in a manifest. The\n * location points at the line where the package name appears in the file (best\n * effort), falling back to line 1.\n */\nfunction dependencyFinding(\n dep: VulnerableDependency,\n file: string,\n content: string,\n index: number,\n): Finding {\n // Use the first listed algorithm for the headline family, but derive the\n // remediation from ALL families the package exposes (C5).\n const algorithm = dep.algorithms[0] ?? \"unknown\";\n return makeFinding({\n ruleId: \"dep-vulnerable\",\n title: `Quantum-vulnerable dependency: ${dep.name}`,\n category: \"dependency\",\n severity: dep.severity,\n confidence: \"high\",\n algorithm,\n // Confidentiality libs are HNDL-exposed; signature-only ones are not. An\n // explicit `dep.hndl` wins (some packages list RSA/EC as a family but only\n // ever sign — e.g. JWS/JWT libs — and signatures are not HNDL-exposed).\n hndl: dep.hndl ?? dep.algorithms.some(isConfidentialityFamily),\n cwe: CWE_BROKEN_CRYPTO,\n message: `${dep.name} — ${dep.reason}`,\n remediation: multiFamilyRemediation(dep.algorithms),\n file,\n content,\n index,\n });\n}\n\n/** Locate the offset of a JSON key `\"name\"` in the manifest text (or 0). */\nfunction offsetOfKey(content: string, name: string): number {\n // Use the precompiled per-name regex (non-global; .exec from position 0).\n const re = KEY_REGEX_BY_NAME.get(name);\n if (!re) return 0;\n const m = re.exec(content);\n return m ? m.index : 0;\n}\n\n/** Sort findings by title for deterministic output. */\nfunction sortByTitle(findings: Finding[]): Finding[] {\n findings.sort((a, b) => (a.title < b.title ? -1 : a.title > b.title ? 1 : 0));\n return findings;\n}\n\n/**\n * Scan a single manifest file for vulnerable dependencies, dispatching by the\n * file's ecosystem ({@link manifestEcosystem}). npm manifests are parsed as\n * JSON; every other ecosystem uses the generous {@link candidateNames} extractor\n * filtered against the ecosystem-scoped database. Returns one finding per\n * distinct vulnerable package.\n */\nexport function scanManifest(file: string, content: string): Finding[] {\n const ecosystem = manifestEcosystem(file);\n if (!ecosystem) return [];\n const db = BY_ECOSYSTEM.get(ecosystem);\n if (!db) return [];\n\n if (ecosystem === \"npm\") {\n const base = (file.split(\"/\").pop() ?? file).toLowerCase();\n // yarn.lock / pnpm-lock.yaml are not JSON — extract names from their text.\n if (base === \"yarn.lock\" || base === \"pnpm-lock.yaml\") {\n return scanNpmLockfile(content, file, db);\n }\n return scanNpmManifest(content, file, db);\n }\n\n const found = new Map<string, VulnerableDependency>(); // dedupe by entry\n for (const raw of candidateNames(ecosystem, content)) {\n const dep = db.get(normalizeName(ecosystem, raw));\n if (dep) found.set(dep.name, dep);\n }\n const findings: Finding[] = [];\n for (const dep of found.values()) {\n findings.push(dependencyFinding(dep, file, content, offsetOfName(content, dep.name)));\n }\n return sortByTitle(findings);\n}\n\n/**\n * npm manifest scan.\n * - `package.json`: dependencies / devDependencies / peerDependencies / optionalDependencies.\n * - `package-lock.json` (v2/v3): the `packages` map keys (node_modules/<name>).\n */\nfunction scanNpmManifest(\n content: string,\n file: string,\n db: Map<string, VulnerableDependency>,\n): Finding[] {\n let json: unknown;\n try {\n json = JSON.parse(content);\n } catch {\n return []; // not valid JSON — skip quietly.\n }\n if (json === null || typeof json !== \"object\") return [];\n\n const found = new Set<string>();\n const obj = json as Record<string, unknown>;\n\n const collectFromRecord = (rec: unknown): void => {\n if (rec === null || typeof rec !== \"object\") return;\n for (const key of Object.keys(rec as Record<string, unknown>)) {\n if (db.has(key)) found.add(key);\n }\n };\n\n collectFromRecord(obj.dependencies);\n collectFromRecord(obj.devDependencies);\n collectFromRecord(obj.peerDependencies);\n collectFromRecord(obj.optionalDependencies);\n\n const packages = obj.packages;\n if (packages !== null && typeof packages === \"object\") {\n for (const key of Object.keys(packages as Record<string, unknown>)) {\n if (!key) continue; // root package entry\n const marker = \"node_modules/\";\n const idx = key.lastIndexOf(marker);\n const name = idx >= 0 ? key.slice(idx + marker.length) : key;\n if (db.has(name)) found.add(name);\n }\n }\n\n const findings: Finding[] = [];\n for (const name of found) {\n const dep = db.get(name);\n if (!dep) continue;\n findings.push(dependencyFinding(dep, file, content, offsetOfKey(content, name)));\n }\n return sortByTitle(findings);\n}\n\n/**\n * Extract candidate package names from a yarn.lock / pnpm-lock.yaml text body.\n * Generous — every `name@…` (and pnpm's `/name/version`) token is captured; the\n * caller filters against the vulnerable-dependency DB, so over-capture is safe.\n * Handles yarn v1 (`elliptic@^6.5.4:`), yarn berry (`\"elliptic@npm:^6.5.4\":`),\n * and pnpm (`/elliptic@6.5.4:`, scoped `/@noble/curves@1.2.0:`).\n */\nfunction npmLockfileCandidates(content: string): string[] {\n const names = new Set<string>();\n const at = /(?:^|[\\s,\"'/])((?:@[a-z0-9._-]+\\/)?[a-z0-9][a-z0-9._-]*)@/gm;\n let m: RegExpExecArray | null;\n while ((m = at.exec(content)) !== null) names.add(m[1].toLowerCase());\n // pnpm's older `/name/version` form (name followed by a version digit).\n const slash = /(?:^|\\s)\\/((?:@[a-z0-9._-]+\\/)?[a-z0-9][a-z0-9._-]*)\\/\\d/gm;\n while ((m = slash.exec(content)) !== null) names.add(m[1].toLowerCase());\n return [...names];\n}\n\n/**\n * npm lockfile scan (yarn.lock / pnpm-lock.yaml): match every package token in\n * the lockfile text against the vulnerable-dependency DB. Catches transitive\n * dependencies that never appear in package.json.\n */\nfunction scanNpmLockfile(\n content: string,\n file: string,\n db: Map<string, VulnerableDependency>,\n): Finding[] {\n const found = new Map<string, VulnerableDependency>();\n for (const name of npmLockfileCandidates(content)) {\n const dep = db.get(name);\n if (dep) found.set(dep.name, dep);\n }\n const findings: Finding[] = [];\n for (const dep of found.values()) {\n findings.push(dependencyFinding(dep, file, content, offsetOfName(content, dep.name)));\n }\n return sortByTitle(findings);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../src/dependencies.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,WAAW,E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KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QACjC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["/**\n * Curated database of packages that primarily expose classical asymmetric\n * cryptography (and are therefore quantum-vulnerable), across multiple\n * ecosystems (npm, PyPI, crates.io, Go modules, Maven, RubyGems, NuGet), plus a\n * manifest scanner that flags any of them found in the corresponding manifest\n * (package.json, requirements.txt, Cargo.toml, go.mod, pom.xml, Gemfile,\n * packages.config / *.csproj, …).\n *\n * The list is intentionally focused on libraries whose *purpose* is classical\n * public-key crypto. General-purpose packages that merely call the language's\n * stdlib crypto are out of scope here (those are caught by the source detectors).\n * Extraction is generous but every finding must match a curated entry, so a new\n * manifest format is cheap to add (see `manifestEcosystem` + `candidateNames`).\n */\nimport type {\n AlgorithmFamily,\n DependencyEcosystem,\n Finding,\n RuleMeta,\n VulnerableDependency,\n} from \"./types.js\";\nimport { makeFinding } from \"./detect-utils.js\";\nimport { isConfidentialityFamily, isSignatureFamily, remediationText } from \"./remediation.js\";\nimport { CWE_BROKEN_CRYPTO } from \"./cwe.js\";\n\n/**\n * Catalog entry for the `dep-vulnerable` rule. Dependency findings are produced\n * by the manifest scanner rather than a registered {@link Detector}, so this\n * rule is absent from `defaultRegistry.ruleCatalog()`. Reporters (SARIF) merge\n * it in so the rule advertises a GENERIC description — the per-package specifics\n * (title/severity/HNDL/remediation) live on each individual finding/result, not\n * on the shared rule. Without this, SARIF would leak the first dependency's\n * package-specific text into the rule-level `shortDescription` for every dep.\n */\nexport const DEP_VULNERABLE_RULE: RuleMeta = {\n id: \"dep-vulnerable\",\n title: \"Quantum-vulnerable dependency\",\n category: \"dependency\",\n // Representative default; each SARIF result carries its own per-package level.\n severity: \"high\",\n confidence: \"high\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"A dependency implements classical public-key cryptography that is broken by \" +\n \"quantum computers. Replace or upgrade it to a post-quantum alternative.\",\n remediation:\n \"Move to a post-quantum alternative — ML-KEM-768 (FIPS 203) for key exchange/\" +\n \"encryption and ML-DSA-65 (FIPS 204) for signatures, ideally via a hybrid.\",\n description:\n \"Flags packages in a dependency manifest known to implement quantum-vulnerable \" +\n \"public-key cryptography (RSA, ECDH/ECDSA, DH, EdDSA, …).\",\n};\n\n/** Known quantum-vulnerable npm dependencies. */\nexport const vulnerableDependencies: VulnerableDependency[] = [\n {\n name: \"node-forge\",\n ecosystem: \"npm\",\n reason: \"Pure-JS implementation of RSA, RSA-OAEP, and X.509 PKI.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"elliptic\",\n ecosystem: \"npm\",\n reason: \"Elliptic-curve ECDSA/ECDH (secp256k1, p256, ed25519).\",\n algorithms: [\"ECDSA\", \"ECDH\", \"EdDSA\"],\n severity: \"high\",\n },\n {\n name: \"jsrsasign\",\n ecosystem: \"npm\",\n reason: \"RSA/ECDSA/DSA signing, JWT, and X.509 in pure JS.\",\n algorithms: [\"RSA\", \"ECDSA\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"node-rsa\",\n ecosystem: \"npm\",\n reason: \"Classical RSA encryption and signing.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"ursa\",\n ecosystem: \"npm\",\n reason: \"OpenSSL-backed RSA encryption and signing bindings.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"sshpk\",\n ecosystem: \"npm\",\n reason: \"Parses/handles SSH and PEM keys (RSA, ECDSA, Ed25519, DSA).\",\n algorithms: [\"RSA\", \"ECDSA\", \"EdDSA\", \"DSA\"],\n severity: \"medium\",\n },\n {\n name: \"jsonwebtoken\",\n ecosystem: \"npm\",\n reason: \"JWTs commonly signed with RS256/ES256 (classical RSA/ECDSA).\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"high\",\n hndl: false,\n },\n {\n name: \"jose\",\n ecosystem: \"npm\",\n reason: \"JWS/JWE with classical RSA-OAEP, RSA-PSS, ECDH-ES and ECDSA.\",\n algorithms: [\"RSA\", \"ECDH\", \"ECDSA\", \"EdDSA\"],\n severity: \"high\",\n },\n {\n name: \"jws\",\n ecosystem: \"npm\",\n reason: \"JSON Web Signatures using classical RS/ES algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"high\",\n hndl: false,\n },\n {\n name: \"eccrypto\",\n ecosystem: \"npm\",\n reason: \"ECIES (ECDH-based) encryption and ECDSA signatures.\",\n algorithms: [\"ECIES\", \"ECDH\", \"ECDSA\"],\n severity: \"high\",\n },\n {\n name: \"secp256k1\",\n ecosystem: \"npm\",\n reason: \"secp256k1 ECDSA/ECDH bindings (blockchain keys).\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"tweetnacl\",\n ecosystem: \"npm\",\n reason: \"X25519 key exchange and Ed25519 signatures (modern but classical).\",\n algorithms: [\"X25519\", \"EdDSA\"],\n severity: \"low\",\n },\n {\n name: \"ed25519\",\n ecosystem: \"npm\",\n reason: \"Ed25519 signatures (classical).\",\n algorithms: [\"EdDSA\"],\n severity: \"low\",\n },\n {\n name: \"@noble/curves\",\n ecosystem: \"npm\",\n reason: \"Audited classical curves: ECDSA, ECDH, Ed25519, X25519, secp256k1.\",\n algorithms: [\"ECDSA\", \"ECDH\", \"EdDSA\", \"X25519\"],\n severity: \"medium\",\n },\n {\n name: \"@noble/secp256k1\",\n ecosystem: \"npm\",\n reason: \"secp256k1 ECDSA/ECDH (classical).\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"@noble/ed25519\",\n ecosystem: \"npm\",\n reason: \"Ed25519 signatures and X25519 key exchange (classical).\",\n algorithms: [\"EdDSA\", \"X25519\"],\n severity: \"low\",\n },\n {\n name: \"paseto\",\n ecosystem: \"npm\",\n reason: \"PASETO public tokens signed with classical Ed25519 (v2/v4) or RSA.\",\n algorithms: [\"EdDSA\", \"RSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"bcrypto\",\n ecosystem: \"npm\",\n reason: \"Broad classical crypto suite: RSA, ECDSA, ECDH, Ed25519, DSA.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"EdDSA\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"ecpair\",\n ecosystem: \"npm\",\n reason: \"secp256k1 ECDSA key pairs for Bitcoin.\",\n algorithms: [\"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"keypair\",\n ecosystem: \"npm\",\n reason: \"Pure-JS RSA key pair generation.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"ethers\",\n ecosystem: \"npm\",\n reason: \"Ethereum library built on secp256k1 ECDSA signing and key derivation.\",\n algorithms: [\"ECDSA\"],\n severity: \"high\",\n },\n {\n name: \"web3\",\n ecosystem: \"npm\",\n reason: \"Ethereum library using secp256k1 ECDSA for accounts and signing.\",\n algorithms: [\"ECDSA\"],\n severity: \"high\",\n },\n {\n name: \"bitcoinjs-lib\",\n ecosystem: \"npm\",\n reason: \"Bitcoin library built on secp256k1 ECDSA/Schnorr keys and signatures.\",\n algorithms: [\"ECDSA\"],\n severity: \"high\",\n },\n {\n name: \"ethereumjs-util\",\n ecosystem: \"npm\",\n reason: \"secp256k1 ECDSA utilities for Ethereum keys and signatures.\",\n algorithms: [\"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"openpgp\",\n ecosystem: \"npm\",\n reason: \"OpenPGP.js: RSA, ECDSA, ECDH, and EdDSA public-key crypto.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"EdDSA\"],\n severity: \"high\",\n },\n {\n name: \"node-jose\",\n ecosystem: \"npm\",\n reason: \"JOSE (JWS/JWE/JWK) with classical RSA and EC algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"jwa\",\n ecosystem: \"npm\",\n reason: \"JSON Web Algorithms: RSA (RS/PS) and EC (ES) signatures.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"jwk-to-pem\",\n ecosystem: \"npm\",\n reason: \"Converts RSA/EC JWKs to PEM — classical public keys.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"fast-jwt\",\n ecosystem: \"npm\",\n reason: \"JWT signing/verification with classical RS/PS/ES algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"ssh2\",\n ecosystem: \"npm\",\n reason: \"SSH client/server using classical RSA/ECDSA/Ed25519 host and user keys.\",\n algorithms: [\"RSA\", \"ECDSA\", \"EdDSA\"],\n severity: \"high\",\n },\n {\n name: \"@peculiar/x509\",\n ecosystem: \"npm\",\n reason: \"X.509 certificate library over classical RSA/EC keys.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"pkijs\",\n ecosystem: \"npm\",\n reason: \"PKI (X.509/CMS) built on classical RSA and EC public-key crypto.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"http-signature\",\n ecosystem: \"npm\",\n reason: \"HTTP request signing with classical RSA/ECDSA keys.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"libsodium-wrappers\",\n ecosystem: \"npm\",\n reason: \"libsodium: Ed25519 signatures and X25519 key exchange (classical).\",\n algorithms: [\"EdDSA\", \"X25519\"],\n severity: \"medium\",\n },\n {\n name: \"ecdsa-sig-formatter\",\n ecosystem: \"npm\",\n reason: \"Formats ECDSA signatures — a marker of classical EC signing.\",\n algorithms: [\"ECDSA\"],\n severity: \"low\",\n },\n\n // --- PyPI (Python) ---\n {\n name: \"pycryptodome\",\n ecosystem: \"pypi\",\n reason: \"RSA / ECC / DSA public-key crypto for Python.\",\n algorithms: [\"RSA\", \"ECDSA\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"pycrypto\",\n ecosystem: \"pypi\",\n reason: \"Abandoned/unmaintained crypto library — classical RSA/DSA/ElGamal.\",\n algorithms: [\"RSA\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"jwcrypto\",\n ecosystem: \"pypi\",\n reason: \"JWK / JWS / JWE with classical RS*/ES* and ECDH-ES key agreement.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"authlib\",\n ecosystem: \"pypi\",\n reason: \"OAuth / OIDC / JOSE stack using classical RS*/ES* JWT signing.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"pycryptodomex\",\n ecosystem: \"pypi\",\n reason: \"RSA / ECC / DSA public-key crypto (the `Cryptodome` namespace).\",\n algorithms: [\"RSA\", \"ECDSA\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"rsa\",\n ecosystem: \"pypi\",\n reason: \"Pure-Python RSA encryption and signing.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"ecdsa\",\n ecosystem: \"pypi\",\n reason: \"Pure-Python ECDSA/ECDH over NIST + secp256k1 curves.\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"cryptography\",\n ecosystem: \"pypi\",\n reason: \"General crypto library exposing classical RSA/EC/DH/DSA (also symmetric/PQC).\",\n algorithms: [\"RSA\", \"ECDH\", \"ECDSA\", \"DSA\"],\n severity: \"medium\",\n },\n {\n name: \"pyjwt\",\n ecosystem: \"pypi\",\n reason: \"JWT signing with classical RS*/ES* algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"python-jose\",\n ecosystem: \"pypi\",\n reason: \"JOSE/JWT with classical RSA/ECDSA algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"paramiko\",\n ecosystem: \"pypi\",\n reason: \"SSH client/server with classical RSA/ECDSA/Ed25519/DSA host + user keys.\",\n algorithms: [\"RSA\", \"ECDSA\", \"EdDSA\", \"DSA\"],\n severity: \"medium\",\n },\n {\n name: \"pyopenssl\",\n ecosystem: \"pypi\",\n reason: \"OpenSSL bindings for classical RSA/EC X.509 + TLS.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"pynacl\",\n ecosystem: \"pypi\",\n reason:\n \"libsodium bindings — X25519 key agreement and Ed25519 signatures (modern but classical).\",\n algorithms: [\"X25519\", \"EdDSA\"],\n severity: \"low\",\n },\n\n // --- crates.io (Rust) ---\n {\n name: \"rsa\",\n ecosystem: \"cargo\",\n reason: \"Pure-Rust RSA encryption and signing.\",\n algorithms: [\"RSA\"],\n severity: \"high\",\n },\n {\n name: \"ring\",\n ecosystem: \"cargo\",\n reason: \"RSA / ECDSA / Ed25519 / ECDH primitives.\",\n algorithms: [\"RSA\", \"ECDSA\", \"EdDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"openssl\",\n ecosystem: \"cargo\",\n reason: \"OpenSSL bindings for classical RSA/EC crypto.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"p256\",\n ecosystem: \"cargo\",\n reason: \"NIST P-256 ECDSA signatures and ECDH key agreement.\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"p384\",\n ecosystem: \"cargo\",\n reason: \"NIST P-384 ECDSA signatures and ECDH key agreement.\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"k256\",\n ecosystem: \"cargo\",\n reason: \"secp256k1 ECDSA signatures and ECDH key agreement.\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"secp256k1\",\n ecosystem: \"cargo\",\n reason: \"libsecp256k1 bindings (blockchain) — classical ECDSA + ECDH.\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"high\",\n },\n {\n name: \"ed25519-dalek\",\n ecosystem: \"cargo\",\n reason: \"Ed25519 signatures (modern but classical).\",\n algorithms: [\"EdDSA\"],\n severity: \"low\",\n },\n {\n name: \"x25519-dalek\",\n ecosystem: \"cargo\",\n reason: \"X25519 key agreement (modern but classical).\",\n algorithms: [\"X25519\"],\n severity: \"low\",\n },\n\n // --- Go modules ---\n {\n name: \"golang.org/x/crypto\",\n ecosystem: \"go\",\n reason: \"SSH, OpenPGP, and classical curve helpers on top of the Go stdlib.\",\n algorithms: [\"RSA\", \"ECDSA\", \"EdDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"github.com/golang-jwt/jwt/v5\",\n ecosystem: \"go\",\n reason: \"golang-jwt — classical RS*/PS*/ES* JWT algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"github.com/golang-jwt/jwt/v4\",\n ecosystem: \"go\",\n reason: \"golang-jwt (v4) — classical RS*/PS*/ES* JWT algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"github.com/go-jose/go-jose/v4\",\n ecosystem: \"go\",\n reason: \"go-jose — classical JOSE (RSA/ECDSA signatures, ECDH-ES key agreement).\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"github.com/cloudflare/circl\",\n ecosystem: \"go\",\n reason:\n \"Cloudflare CIRCL — classical ECDH/EdDSA curves (X25519, X448, Ed25519, P-256); also ships PQC (ML-KEM/ML-DSA + hybrids), so migrate the classical *usage*, not the package.\",\n algorithms: [\"ECDH\", \"EdDSA\"],\n severity: \"medium\",\n },\n {\n name: \"github.com/decred/dcrd/dcrec/secp256k1/v4\",\n ecosystem: \"go\",\n reason: \"decred secp256k1 — classical ECDSA/ECDH on the secp256k1 curve (blockchain keys).\",\n algorithms: [\"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n\n // --- Maven (Java) ---\n {\n name: \"bcprov-jdk18on\",\n ecosystem: \"maven\",\n reason: \"BouncyCastle provider — full classical RSA/ECDSA/ECDH/DSA suite.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"bcprov-jdk15on\",\n ecosystem: \"maven\",\n reason: \"BouncyCastle provider (JDK 1.5+) — classical RSA/ECDSA/ECDH/DSA.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"bcpkix-jdk18on\",\n ecosystem: \"maven\",\n reason: \"BouncyCastle PKIX — classical X.509 / CMS with RSA/ECDSA.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n },\n {\n name: \"java-jwt\",\n ecosystem: \"maven\",\n reason: \"Auth0 JWT with classical RS*/ES* algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"nimbus-jose-jwt\",\n ecosystem: \"maven\",\n reason: \"Nimbus JOSE+JWT — classical RS*/PS*/ES* JWS and RSA/ECDH-ES JWE.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"jjwt-api\",\n ecosystem: \"maven\",\n reason: \"JJWT (io.jsonwebtoken) — classical RS*/ES* JWT signing.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n\n // --- RubyGems ---\n {\n name: \"jwt\",\n ecosystem: \"rubygems\",\n reason: \"Ruby JWT with classical RS*/ES* algorithms.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"net-ssh\",\n ecosystem: \"rubygems\",\n reason:\n \"Ruby SSH client — classical host/user keys (RSA/ECDSA/Ed25519) and ECDH/DH key exchange.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\"],\n severity: \"medium\",\n },\n {\n name: \"rbnacl\",\n ecosystem: \"rubygems\",\n reason: \"libsodium bindings — X25519 key agreement and Ed25519 signatures.\",\n algorithms: [\"X25519\", \"EdDSA\"],\n severity: \"low\",\n },\n {\n name: \"ed25519\",\n ecosystem: \"rubygems\",\n reason: \"Ed25519 signatures (modern but classical).\",\n algorithms: [\"EdDSA\"],\n severity: \"low\",\n },\n\n // --- NuGet (.NET) ---\n {\n name: \"BouncyCastle.Cryptography\",\n ecosystem: \"nuget\",\n reason: \"BouncyCastle for .NET — full classical RSA/ECDSA/ECDH/DSA suite.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"Portable.BouncyCastle\",\n ecosystem: \"nuget\",\n reason: \"Portable BouncyCastle for .NET — classical RSA/ECDSA/ECDH/DSA.\",\n algorithms: [\"RSA\", \"ECDSA\", \"ECDH\", \"DSA\"],\n severity: \"high\",\n },\n {\n name: \"System.IdentityModel.Tokens.Jwt\",\n ecosystem: \"nuget\",\n reason: \"Microsoft JWT handler — classical RS*/ES* (RSA/ECDSA) signatures.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n {\n name: \"Microsoft.IdentityModel.Tokens\",\n ecosystem: \"nuget\",\n reason: \"Microsoft IdentityModel token crypto — classical RSA/ECDSA keys.\",\n algorithms: [\"RSA\", \"ECDSA\"],\n severity: \"medium\",\n hndl: false,\n },\n];\n\n/**\n * Normalise a package name for matching within its ecosystem. PyPI is\n * case-insensitive and folds runs of `-_.` to a single `-` (PEP 503); cargo /\n * maven / rubygems / nuget are effectively lower-case (NuGet ids are matched\n * case-insensitively); npm and go module paths are matched verbatim (npm scopes\n * and go paths are case-sensitive).\n */\nfunction normalizeName(ecosystem: DependencyEcosystem, name: string): string {\n const n = name.trim();\n if (ecosystem === \"pypi\") return n.toLowerCase().replace(/[-_.]+/g, \"-\");\n if (ecosystem === \"npm\" || ecosystem === \"go\") return n;\n return n.toLowerCase();\n}\n\n/** ecosystem → (normalised name → entry). Scoped so `rsa` (pypi) ≠ `rsa` (cargo). */\nconst BY_ECOSYSTEM: Map<DependencyEcosystem, Map<string, VulnerableDependency>> = (() => {\n const m = new Map<DependencyEcosystem, Map<string, VulnerableDependency>>();\n for (const d of vulnerableDependencies) {\n let em = m.get(d.ecosystem);\n if (!em) {\n em = new Map();\n m.set(d.ecosystem, em);\n }\n em.set(normalizeName(d.ecosystem, d.name), d);\n }\n return m;\n})();\n\n/**\n * Precompiled `\"name\":` lookup regex per known npm package (P1-9): the set is\n * static, so build the (name → RegExp) map once rather than per manifest. Only\n * npm uses the JSON-key form; other ecosystems locate names generically.\n */\nconst KEY_REGEX_BY_NAME = new Map<string, RegExp>(\n vulnerableDependencies\n .filter((d) => d.ecosystem === \"npm\")\n .map((d): [string, RegExp] => {\n const escaped = d.name.replace(/[.*+?^${}()|[\\]\\\\/]/g, \"\\\\$&\");\n return [d.name, new RegExp(`\"${escaped}\"\\\\s*:`)];\n }),\n);\n\n/**\n * Build a remediation string covering ALL families a package exposes (C5),\n * rather than only `algorithms[0]`. De-duplicates by PQC *target* — the KEM\n * target and the signature target are each named at most once — so a library\n * exposing both a confidentiality family and a signature family reads\n * \"ML-KEM-768 … for key exchange/encryption; ML-DSA-65 (FIPS 204) for\n * signatures\" instead of repeating ML-DSA (the old per-string Set couldn't\n * collapse \"ML-DSA-65 for signatures\" against a standalone \"ML-DSA-65 (FIPS 204)\").\n */\nfunction multiFamilyRemediation(algorithms: readonly AlgorithmFamily[]): string {\n let needsKem = false;\n let needsSig = false;\n let needsReview = false;\n for (const a of algorithms) {\n if (isConfidentialityFamily(a)) needsKem = true;\n if (isSignatureFamily(a)) needsSig = true;\n if (a === \"unknown\") needsReview = true;\n }\n const parts: string[] = [];\n if (needsKem)\n parts.push(\"ML-KEM-768 (FIPS 203, hybrid X25519MLKEM768) for key exchange/encryption\");\n if (needsSig) parts.push(\"ML-DSA-65 (FIPS 204) for signatures\");\n // Only fall back to the generic \"review\" line when nothing concrete applied.\n if (needsReview && parts.length === 0) parts.push(remediationText(\"unknown\"));\n return parts.join(\"; \");\n}\n\n/**\n * The dependency ecosystem a manifest filename belongs to, or null when the file\n * is not a manifest we parse. Drives both {@link isManifestFile} and the scanner\n * dispatch — one place to add a manifest format.\n */\nexport function manifestEcosystem(file: string): DependencyEcosystem | null {\n const base = (file.split(\"/\").pop() ?? file).toLowerCase();\n if (\n base === \"package.json\" ||\n base === \"package-lock.json\" ||\n base === \"npm-shrinkwrap.json\" ||\n base === \"yarn.lock\" ||\n base === \"pnpm-lock.yaml\"\n ) {\n return \"npm\";\n }\n if (base === \"requirements.txt\" || /^requirements[\\w.-]*\\.txt$/.test(base)) return \"pypi\";\n if (base === \"pyproject.toml\" || base === \"pipfile\") return \"pypi\";\n if (base === \"cargo.toml\") return \"cargo\";\n if (base === \"go.mod\") return \"go\";\n if (base === \"pom.xml\" || base === \"build.gradle\" || base === \"build.gradle.kts\") return \"maven\";\n if (base === \"gemfile\" || base.endsWith(\".gemspec\")) return \"rubygems\";\n if (base === \"packages.config\" || base === \"directory.packages.props\" || base.endsWith(\".csproj\"))\n return \"nuget\";\n return null;\n}\n\n/** True if a file path looks like a manifest we can parse for dependencies. */\nexport function isManifestFile(file: string): boolean {\n return manifestEcosystem(file) !== null;\n}\n\n/**\n * Extract candidate package names from a non-npm manifest. Extraction is\n * deliberately GENEROUS — every finding still has to match a curated DB entry,\n * so over-extracting harmless tokens (e.g. a TOML `version = …` key) costs\n * nothing while keeping the parsers tiny and format-tolerant.\n */\nfunction candidateNames(ecosystem: DependencyEcosystem, content: string): string[] {\n const names: string[] = [];\n const lines = content.split(\"\\n\");\n switch (ecosystem) {\n case \"pypi\": {\n // requirements.txt / Pipfile / pyproject.toml: leading token per line, plus\n // quoted deps in arrays/tables. Skip comments and `-r/-e/--flag` lines.\n for (const raw of lines) {\n const line = raw.trim();\n if (!line || line.startsWith(\"#\") || line.startsWith(\"-\")) continue;\n const lead = /^[\"']?([A-Za-z][A-Za-z0-9._-]+)/.exec(line);\n if (lead) names.push(lead[1]);\n for (const m of line.matchAll(/[\"']([A-Za-z][A-Za-z0-9._-]+)/g)) names.push(m[1]);\n }\n break;\n }\n case \"cargo\": {\n // Cargo.toml: dependency-table keys `name = …` and `[…dependencies.name]`.\n for (const raw of lines) {\n const line = raw.trim();\n if (!line || line.startsWith(\"#\")) continue;\n const key = /^([A-Za-z0-9][A-Za-z0-9_-]+)\\s*=/.exec(line);\n if (key) names.push(key[1]);\n const table = /^\\[[\\w.-]*dependencies\\.([A-Za-z0-9][A-Za-z0-9_-]+)\\]/.exec(line);\n if (table) names.push(table[1]);\n }\n break;\n }\n case \"go\": {\n // go.mod: `require path v1.2.3` (single or in a require( … ) block).\n for (const m of content.matchAll(/(?:^|\\s)([a-z0-9][\\w.\\-/]+)\\s+v\\d/gm)) names.push(m[1]);\n break;\n }\n case \"maven\": {\n // pom.xml <artifactId> tags + gradle `group:artifact:version` strings.\n for (const m of content.matchAll(/<artifactId>\\s*([\\w.-]+)\\s*<\\/artifactId>/g)) {\n names.push(m[1]);\n }\n for (const m of content.matchAll(/[\"']([\\w.-]+):([\\w.-]+):[\\w.$-]+[\"']/g)) names.push(m[2]);\n break;\n }\n case \"rubygems\": {\n // Gemfile `gem 'name'` + gemspec `add_*dependency 'name'`.\n for (const m of content.matchAll(/\\bgem\\s+[\"']([\\w.-]+)[\"']/g)) names.push(m[1]);\n for (const m of content.matchAll(\n /add(?:_runtime|_development)?_dependency\\s+[\"']([\\w.-]+)[\"']/g,\n )) {\n names.push(m[1]);\n }\n break;\n }\n case \"nuget\": {\n // NuGet manifests are XML. `.csproj` / `Directory.Packages.props` declare\n // `<PackageReference Include=\"Name\" … />`; `packages.config` uses\n // `<package id=\"Name\" … />`. Pull the Include= / id= attribute value from\n // each. The `[^>]` guard keeps every match inside a single tag, so the\n // scan is linear (no nested quantifiers → no catastrophic backtracking).\n for (const m of content.matchAll(/<PackageReference\\b[^>]*\\bInclude\\s*=\\s*\"([^\"]+)\"/gi)) {\n names.push(m[1]);\n }\n for (const m of content.matchAll(/<package\\b[^>]*\\bid\\s*=\\s*\"([^\"]+)\"/gi)) {\n names.push(m[1]);\n }\n break;\n }\n case \"npm\":\n break; // npm uses the JSON path, not this extractor.\n }\n return names;\n}\n\n/** First offset of a package `name` as a whole token in the manifest text (or 0). */\nfunction offsetOfName(content: string, name: string): number {\n const escaped = name.replace(/[.*+?^${}()|[\\]\\\\/]/g, \"\\\\$&\");\n const m = new RegExp(`(?<![\\\\w./-])${escaped}(?![\\\\w-])`).exec(content);\n return m ? m.index : 0;\n}\n\n/**\n * Build a finding for a vulnerable dependency located in a manifest. The\n * location points at the line where the package name appears in the file (best\n * effort), falling back to line 1.\n */\nfunction dependencyFinding(\n dep: VulnerableDependency,\n file: string,\n content: string,\n index: number,\n): Finding {\n // Use the first listed algorithm for the headline family, but derive the\n // remediation from ALL families the package exposes (C5).\n const algorithm = dep.algorithms[0] ?? \"unknown\";\n return makeFinding({\n ruleId: \"dep-vulnerable\",\n title: `Quantum-vulnerable dependency: ${dep.name}`,\n category: \"dependency\",\n severity: dep.severity,\n confidence: \"high\",\n algorithm,\n // Confidentiality libs are HNDL-exposed; signature-only ones are not. An\n // explicit `dep.hndl` wins (some packages list RSA/EC as a family but only\n // ever sign — e.g. JWS/JWT libs — and signatures are not HNDL-exposed).\n hndl: dep.hndl ?? dep.algorithms.some(isConfidentialityFamily),\n cwe: CWE_BROKEN_CRYPTO,\n message: `${dep.name} — ${dep.reason}`,\n remediation: multiFamilyRemediation(dep.algorithms),\n file,\n content,\n index,\n });\n}\n\n/** Locate the offset of a JSON key `\"name\"` in the manifest text (or 0). */\nfunction offsetOfKey(content: string, name: string): number {\n // Use the precompiled per-name regex (non-global; .exec from position 0).\n const re = KEY_REGEX_BY_NAME.get(name);\n if (!re) return 0;\n const m = re.exec(content);\n return m ? m.index : 0;\n}\n\n/** Sort findings by title for deterministic output. */\nfunction sortByTitle(findings: Finding[]): Finding[] {\n findings.sort((a, b) => (a.title < b.title ? -1 : a.title > b.title ? 1 : 0));\n return findings;\n}\n\n/**\n * Scan a single manifest file for vulnerable dependencies, dispatching by the\n * file's ecosystem ({@link manifestEcosystem}). npm manifests are parsed as\n * JSON; every other ecosystem uses the generous {@link candidateNames} extractor\n * filtered against the ecosystem-scoped database. Returns one finding per\n * distinct vulnerable package.\n */\nexport function scanManifest(file: string, content: string): Finding[] {\n const ecosystem = manifestEcosystem(file);\n if (!ecosystem) return [];\n const db = BY_ECOSYSTEM.get(ecosystem);\n if (!db) return [];\n\n if (ecosystem === \"npm\") {\n const base = (file.split(\"/\").pop() ?? file).toLowerCase();\n // yarn.lock / pnpm-lock.yaml are not JSON — extract names from their text.\n if (base === \"yarn.lock\" || base === \"pnpm-lock.yaml\") {\n return scanNpmLockfile(content, file, db);\n }\n return scanNpmManifest(content, file, db);\n }\n\n const found = new Map<string, VulnerableDependency>(); // dedupe by entry\n for (const raw of candidateNames(ecosystem, content)) {\n const dep = db.get(normalizeName(ecosystem, raw));\n if (dep) found.set(dep.name, dep);\n }\n const findings: Finding[] = [];\n for (const dep of found.values()) {\n findings.push(dependencyFinding(dep, file, content, offsetOfName(content, dep.name)));\n }\n return sortByTitle(findings);\n}\n\n/**\n * npm manifest scan.\n * - `package.json`: dependencies / devDependencies / peerDependencies / optionalDependencies.\n * - `package-lock.json` (v2/v3): the `packages` map keys (node_modules/<name>).\n */\nfunction scanNpmManifest(\n content: string,\n file: string,\n db: Map<string, VulnerableDependency>,\n): Finding[] {\n let json: unknown;\n try {\n json = JSON.parse(content);\n } catch {\n return []; // not valid JSON — skip quietly.\n }\n if (json === null || typeof json !== \"object\") return [];\n\n const found = new Set<string>();\n const obj = json as Record<string, unknown>;\n\n const collectFromRecord = (rec: unknown): void => {\n if (rec === null || typeof rec !== \"object\") return;\n for (const key of Object.keys(rec as Record<string, unknown>)) {\n if (db.has(key)) found.add(key);\n }\n };\n\n collectFromRecord(obj.dependencies);\n collectFromRecord(obj.devDependencies);\n collectFromRecord(obj.peerDependencies);\n collectFromRecord(obj.optionalDependencies);\n\n const packages = obj.packages;\n if (packages !== null && typeof packages === \"object\") {\n for (const key of Object.keys(packages as Record<string, unknown>)) {\n if (!key) continue; // root package entry\n const marker = \"node_modules/\";\n const idx = key.lastIndexOf(marker);\n const name = idx >= 0 ? key.slice(idx + marker.length) : key;\n if (db.has(name)) found.add(name);\n }\n }\n\n const findings: Finding[] = [];\n for (const name of found) {\n const dep = db.get(name);\n if (!dep) continue;\n findings.push(dependencyFinding(dep, file, content, offsetOfKey(content, name)));\n }\n return sortByTitle(findings);\n}\n\n/**\n * Extract candidate package names from a yarn.lock / pnpm-lock.yaml text body.\n * Generous — every `name@…` (and pnpm's `/name/version`) token is captured; the\n * caller filters against the vulnerable-dependency DB, so over-capture is safe.\n * Handles yarn v1 (`elliptic@^6.5.4:`), yarn berry (`\"elliptic@npm:^6.5.4\":`),\n * and pnpm (`/elliptic@6.5.4:`, scoped `/@noble/curves@1.2.0:`).\n */\nfunction npmLockfileCandidates(content: string): string[] {\n const names = new Set<string>();\n const at = /(?:^|[\\s,\"'/])((?:@[a-z0-9._-]+\\/)?[a-z0-9][a-z0-9._-]*)@/gm;\n let m: RegExpExecArray | null;\n while ((m = at.exec(content)) !== null) names.add(m[1].toLowerCase());\n // pnpm's older `/name/version` form (name followed by a version digit).\n const slash = /(?:^|\\s)\\/((?:@[a-z0-9._-]+\\/)?[a-z0-9][a-z0-9._-]*)\\/\\d/gm;\n while ((m = slash.exec(content)) !== null) names.add(m[1].toLowerCase());\n return [...names];\n}\n\n/**\n * npm lockfile scan (yarn.lock / pnpm-lock.yaml): match every package token in\n * the lockfile text against the vulnerable-dependency DB. Catches transitive\n * dependencies that never appear in package.json.\n */\nfunction scanNpmLockfile(\n content: string,\n file: string,\n db: Map<string, VulnerableDependency>,\n): Finding[] {\n const found = new Map<string, VulnerableDependency>();\n for (const name of npmLockfileCandidates(content)) {\n const dep = db.get(name);\n if (dep) found.set(dep.name, dep);\n }\n const findings: Finding[] = [];\n for (const dep of found.values()) {\n findings.push(dependencyFinding(dep, file, content, offsetOfName(content, dep.name)));\n }\n return sortByTitle(findings);\n}\n"]}
|
package/dist/detect-utils.d.ts
CHANGED
|
@@ -91,6 +91,10 @@ export declare const CSHARP_EXTENSIONS: readonly string[];
|
|
|
91
91
|
export declare const RUST_EXTENSIONS: readonly string[];
|
|
92
92
|
/** Ruby source extensions handled by the Ruby detector. */
|
|
93
93
|
export declare const RUBY_EXTENSIONS: readonly string[];
|
|
94
|
+
/** Elixir source extensions handled by the Elixir detector. */
|
|
95
|
+
export declare const ELIXIR_EXTENSIONS: readonly string[];
|
|
96
|
+
/** PHP source extensions handled by the PHP detector. */
|
|
97
|
+
export declare const PHP_EXTENSIONS: readonly string[];
|
|
94
98
|
/** C / C++ source extensions handled by the OpenSSL detector. */
|
|
95
99
|
export declare const C_EXTENSIONS: readonly string[];
|
|
96
100
|
/**
|
|
@@ -126,7 +130,7 @@ export declare const ANALYZABLE_SOURCE_EXTENSIONS: readonly string[];
|
|
|
126
130
|
* crypto, shown in coverage output. Kept next to {@link
|
|
127
131
|
* ANALYZABLE_SOURCE_EXTENSIONS} so a new language pack updates one place.
|
|
128
132
|
*/
|
|
129
|
-
export declare const ANALYZABLE_LANGUAGES_LABEL = "JS/TS, Python, Go, Java, C#, Rust, Ruby, C/C++";
|
|
133
|
+
export declare const ANALYZABLE_LANGUAGES_LABEL = "JS/TS, Python, Go, Java/Kotlin/Scala, C#, Rust, Ruby, PHP, Elixir, C/C++";
|
|
130
134
|
/** True when a path is in a source language the scanner can analyze for crypto. */
|
|
131
135
|
export declare function isAnalyzableSource(filePath: string): boolean;
|
|
132
136
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-utils.d.ts","sourceRoot":"","sources":["../src/detect-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,OAAO,EACP,eAAe,EACf,QAAQ,EACR,QAAQ,EACT,MAAM,YAAY,CAAC;AAGpB,sEAAsE;AACtE,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAwCD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAIxE;AAED,oEAAoE;AACpE,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ9D;AAED,sCAAsC;AACtC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MA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,EAAE,SAAS,MAAM,EAY3C,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAKhD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,EAAE,SAAS,MAAM,EAWzD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,6EACqC,CAAC;AAE7E,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,OAAO,CAgBT;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GACxC,IAAI,CAQN"}
|
package/dist/detect-utils.js
CHANGED
|
@@ -150,13 +150,20 @@ export const PYTHON_EXTENSIONS = [".py", ".pyi", ".pyw"];
|
|
|
150
150
|
/** Go source extensions handled by the Go detector. */
|
|
151
151
|
export const GO_EXTENSIONS = [".go"];
|
|
152
152
|
/** Java / Kotlin source extensions handled by the JCA detector. */
|
|
153
|
-
|
|
153
|
+
// The JVM detector also covers Kotlin (`.kt`/`.kts`) and Scala (`.scala`/`.sc`):
|
|
154
|
+
// all three compile against the same JCA (`KeyPairGenerator`, `Signature`,
|
|
155
|
+
// `KeyAgreement`) and BouncyCastle APIs the Java rules match.
|
|
156
|
+
export const JAVA_EXTENSIONS = [".java", ".kt", ".kts", ".scala", ".sc"];
|
|
154
157
|
/** C# source extensions handled by the .NET detector. */
|
|
155
158
|
export const CSHARP_EXTENSIONS = [".cs"];
|
|
156
159
|
/** Rust source extensions handled by the Rust detector. */
|
|
157
160
|
export const RUST_EXTENSIONS = [".rs"];
|
|
158
161
|
/** Ruby source extensions handled by the Ruby detector. */
|
|
159
162
|
export const RUBY_EXTENSIONS = [".rb"];
|
|
163
|
+
/** Elixir source extensions handled by the Elixir detector. */
|
|
164
|
+
export const ELIXIR_EXTENSIONS = [".ex", ".exs"];
|
|
165
|
+
/** PHP source extensions handled by the PHP detector. */
|
|
166
|
+
export const PHP_EXTENSIONS = [".php", ".phtml", ".php3", ".php4", ".php5"];
|
|
160
167
|
/** C / C++ source extensions handled by the OpenSSL detector. */
|
|
161
168
|
export const C_EXTENSIONS = [".c", ".h", ".cc", ".cpp", ".cxx", ".hpp", ".hh"];
|
|
162
169
|
/**
|
|
@@ -211,6 +218,8 @@ export const ANALYZABLE_SOURCE_EXTENSIONS = [
|
|
|
211
218
|
...CSHARP_EXTENSIONS,
|
|
212
219
|
...RUST_EXTENSIONS,
|
|
213
220
|
...RUBY_EXTENSIONS,
|
|
221
|
+
...PHP_EXTENSIONS,
|
|
222
|
+
...ELIXIR_EXTENSIONS,
|
|
214
223
|
...C_EXTENSIONS,
|
|
215
224
|
];
|
|
216
225
|
/**
|
|
@@ -218,7 +227,7 @@ export const ANALYZABLE_SOURCE_EXTENSIONS = [
|
|
|
218
227
|
* crypto, shown in coverage output. Kept next to {@link
|
|
219
228
|
* ANALYZABLE_SOURCE_EXTENSIONS} so a new language pack updates one place.
|
|
220
229
|
*/
|
|
221
|
-
export const ANALYZABLE_LANGUAGES_LABEL = "JS/TS, Python, Go, Java, C#, Rust, Ruby, C/C++";
|
|
230
|
+
export const ANALYZABLE_LANGUAGES_LABEL = "JS/TS, Python, Go, Java/Kotlin/Scala, C#, Rust, Ruby, PHP, Elixir, C/C++";
|
|
222
231
|
/** True when a path is in a source language the scanner can analyze for crypto. */
|
|
223
232
|
export function isAnalyzableSource(filePath) {
|
|
224
233
|
return hasExtension(filePath, ANALYZABLE_SOURCE_EXTENSIONS);
|
package/dist/detect-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-utils.js","sourceRoot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,EAAU,EACV,OAAe,EACf,OAAyC;IAEzC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;IACjE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;IAChB,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACtC,OAAO,CAAC,CAAC,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,SAAS;YAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,qCAAqC;IACnF,CAAC;AACH,CAAC","sourcesContent":["/**\n * Shared helpers for the regex-based source detectors: turning a string offset\n * into a 1-based line/column, extracting a trimmed single-line snippet, and a\n * small factory for building Finding objects with consistent remediation text.\n */\nimport type {\n AlgorithmFamily,\n Confidence,\n Finding,\n FindingCategory,\n RuleMeta,\n Severity,\n} from \"./types.js\";\nimport { remediationText } from \"./remediation.js\";\n\n/** A 1-based line/column position derived from a character offset. */\nexport interface LineCol {\n line: number;\n column: number;\n}\n\n/**\n * Memoized line-start offsets for the CURRENT content string. A scan processes\n * all of one file's findings consecutively against the same `content` reference,\n * so a single-entry cache turns the previously O(offset)-per-finding line/column\n * math into O(log n) — the whole file is O(n log n) instead of O(n²). Without\n * this, a large file with many findings scaled quadratically (a real perf cliff,\n * caught by the ReDoS/time-budget test).\n */\nlet cachedContent: string | null = null;\nlet cachedLineStarts: number[] = [];\nfunction lineStartsFor(content: string): number[] {\n if (content === cachedContent) return cachedLineStarts;\n const starts = [0];\n for (let i = 0; i < content.length; i++) {\n if (content.charCodeAt(i) === 10 /* \\n */) starts.push(i + 1);\n }\n cachedContent = content;\n cachedLineStarts = starts;\n return starts;\n}\n\n/** Index of the line containing `offset` (0-based into the line-starts array). */\nfunction lineIndexFor(starts: readonly number[], offset: number): number {\n let lo = 0;\n let hi = starts.length - 1;\n let best = 0;\n while (lo <= hi) {\n const mid = (lo + hi) >>> 1;\n if (starts[mid] <= offset) {\n best = mid;\n lo = mid + 1;\n } else {\n hi = mid - 1;\n }\n }\n return best;\n}\n\n/**\n * Convert a 0-based character offset within `content` into a 1-based\n * line/column. Newlines are LF; CR is treated as an ordinary character, so on\n * CRLF files the column includes the trailing CR offset harmlessly.\n */\nexport function offsetToLineCol(content: string, offset: number): LineCol {\n const starts = lineStartsFor(content);\n const idx = lineIndexFor(starts, offset);\n return { line: idx + 1, column: offset - starts[idx] + 1 };\n}\n\n/** Extract the (trimmed) single source line containing `offset`. */\nexport function lineAt(content: string, offset: number): string {\n const starts = lineStartsFor(content);\n const idx = lineIndexFor(starts, offset);\n const start = starts[idx];\n const nextStart = idx + 1 < starts.length ? starts[idx + 1] : content.length + 1;\n // nextStart points just past the '\\n'; the line content ends before it.\n const end = Math.min(nextStart - 1, content.length);\n return content.slice(start, end).replace(/\\r$/, \"\").trim();\n}\n\n/** Inputs for {@link makeFinding}. */\nexport interface FindingSpec {\n ruleId: string;\n title: string;\n category: FindingCategory;\n severity: Severity;\n confidence: Confidence;\n algorithm?: AlgorithmFamily;\n hndl: boolean;\n message: string;\n /** Override the auto-derived remediation text. */\n remediation?: string;\n /** Associated CWE id (e.g. \"CWE-327\"). */\n cwe?: string;\n /** Marks the matched snippet as the sensitive value itself (key material). */\n sensitive?: boolean;\n /** The matched source text and its start offset within `content`. */\n file: string;\n content: string;\n index: number;\n /** Length of the match, used to compute endLine for multi-line matches. */\n matchLength?: number;\n}\n\n/**\n * Build a {@link Finding} with location info derived from a match offset. When\n * no explicit remediation is given but an algorithm is, the canonical\n * remediation text for that family is used.\n */\nexport function makeFinding(spec: FindingSpec): Finding {\n const { line, column } = offsetToLineCol(spec.content, spec.index);\n const snippet = lineAt(spec.content, spec.index);\n\n const remediation =\n spec.remediation ?? (spec.algorithm ? remediationText(spec.algorithm) : undefined);\n\n const location: Finding[\"location\"] = {\n file: spec.file,\n line,\n column,\n snippet: snippet.length > 200 ? `${snippet.slice(0, 197)}...` : snippet,\n };\n\n if (spec.matchLength && spec.matchLength > 0) {\n const matched = spec.content.slice(spec.index, spec.index + spec.matchLength);\n const extraLines = (matched.match(/\\n/g) ?? []).length;\n if (extraLines > 0) location.endLine = line + extraLines;\n }\n\n const finding: Finding = {\n ruleId: spec.ruleId,\n title: spec.title,\n category: spec.category,\n severity: spec.severity,\n confidence: spec.confidence,\n hndl: spec.hndl,\n message: spec.message,\n location,\n };\n if (spec.algorithm) finding.algorithm = spec.algorithm;\n if (remediation) finding.remediation = remediation;\n if (spec.cwe) finding.cwe = spec.cwe;\n if (spec.sensitive) finding.sensitive = true;\n return finding;\n}\n\n/** Where a match occurred, plus optional per-finding field overrides. */\nexport interface RuleMatch {\n file: string;\n content: string;\n /** Match start offset within `content`. */\n index: number;\n /** Length of the match (used to compute endLine for multi-line matches). */\n matchLength?: number;\n}\n\n/**\n * Fields of a {@link RuleMeta} a detector may refine at match time. Multi-variant\n * rules (e.g. key generation across algorithm families) override these; fixed\n * rules pass none and inherit the catalog metadata verbatim.\n */\nexport type RuleOverrides = Partial<\n Pick<\n RuleMeta,\n \"title\" | \"category\" | \"severity\" | \"confidence\" | \"algorithm\" | \"hndl\" | \"message\" | \"cwe\"\n >\n> & { remediation?: string };\n\n/**\n * Build a {@link Finding} from a rule's catalog metadata plus a match location,\n * applying any per-finding overrides. This is the single construction path for\n * detector findings: the invariant fields (title/severity/category/…) live once\n * in the {@link RuleMeta} declaration, so they can't drift from what the SARIF\n * catalog and the MCP resolver report.\n */\nexport function findingFromRule(rule: RuleMeta, at: RuleMatch, overrides?: RuleOverrides): Finding {\n return makeFinding({\n ruleId: rule.id,\n title: overrides?.title ?? rule.title,\n category: overrides?.category ?? rule.category,\n severity: overrides?.severity ?? rule.severity,\n confidence: overrides?.confidence ?? rule.confidence,\n algorithm: overrides?.algorithm ?? rule.algorithm,\n hndl: overrides?.hndl ?? rule.hndl,\n cwe: overrides?.cwe ?? rule.cwe,\n remediation: overrides?.remediation ?? rule.remediation,\n sensitive: rule.sensitive,\n message: overrides?.message ?? rule.message,\n file: at.file,\n content: at.content,\n index: at.index,\n matchLength: at.matchLength,\n });\n}\n\n/** True if `filePath` has one of the given (lower-case, dotted) extensions. */\nexport function hasExtension(filePath: string, exts: readonly string[]): boolean {\n const lower = filePath.toLowerCase();\n return exts.some((e) => lower.endsWith(e));\n}\n\n/**\n * JavaScript / TypeScript source extensions handled by the source detectors.\n * `.vue` / `.svelte` single-file components embed a `<script>` block, so the\n * lexical detectors catch crypto usage inside them.\n */\nexport const JS_TS_EXTENSIONS: readonly string[] = [\n \".js\",\n \".jsx\",\n \".ts\",\n \".tsx\",\n \".mjs\",\n \".cjs\",\n \".vue\",\n \".svelte\",\n];\n\n/** Python source extensions handled by the Python detector. */\nexport const PYTHON_EXTENSIONS: readonly string[] = [\".py\", \".pyi\", \".pyw\"];\n\n/** Go source extensions handled by the Go detector. */\nexport const GO_EXTENSIONS: readonly string[] = [\".go\"];\n\n/** Java / Kotlin source extensions handled by the JCA detector. */\nexport const JAVA_EXTENSIONS: readonly string[] = [\".java\", \".kt\", \".kts\"];\n\n/** C# source extensions handled by the .NET detector. */\nexport const CSHARP_EXTENSIONS: readonly string[] = [\".cs\"];\n\n/** Rust source extensions handled by the Rust detector. */\nexport const RUST_EXTENSIONS: readonly string[] = [\".rs\"];\n\n/** Ruby source extensions handled by the Ruby detector. */\nexport const RUBY_EXTENSIONS: readonly string[] = [\".rb\"];\n\n/** C / C++ source extensions handled by the OpenSSL detector. */\nexport const C_EXTENSIONS: readonly string[] = [\".c\", \".h\", \".cc\", \".cpp\", \".cxx\", \".hpp\", \".hh\"];\n\n/**\n * Prose/documentation extensions. The language-agnostic *token* detectors (SSH\n * public keys, TLS cipher suites, certificate signature algorithms) must not run\n * on these: a changelog or README that mentions `ssh-rsa` or `ECDHE-RSA` in a\n * sentence is prose, not crypto config. (PEM/`-----BEGIN` material stays in scope\n * everywhere, so a key pasted into docs is still caught.)\n */\nexport const DOC_EXTENSIONS: readonly string[] = [\n \".md\",\n \".markdown\",\n \".mdown\",\n \".mkd\",\n \".rst\",\n \".adoc\",\n \".asciidoc\",\n \".textile\",\n \".org\",\n \".rdoc\",\n \".pod\",\n];\n\n/**\n * File-literal surfaces where a JWT/JOSE algorithm string (`\"RS256\"`, `\"ES256\"`)\n * is the same evidence regardless of language. Used to un-gate the JWT detector\n * from JS-only. Covers the languages whose JWT libraries pass the alg as a quoted\n * token — JS/TS, Python, Go (`jwt.GetSigningMethod(\"RS256\")`) and Ruby\n * (`JWT.encode(payload, key, 'RS256')`) — so the regex stays precise (`HS*` HMAC\n * tokens are excluded by `RE_JWT_ALG`). Java/C# pass the alg as an *identifier*\n * (`SignatureAlgorithm.RS256`), which needs its own pattern — a later pass.\n * YAML/JSON config carry unquoted tokens and higher FP risk, so they wait too.\n */\nexport const JWT_HOST_EXTENSIONS: readonly string[] = [\n ...JS_TS_EXTENSIONS,\n ...PYTHON_EXTENSIONS,\n ...GO_EXTENSIONS,\n ...RUBY_EXTENSIONS,\n];\n\n/**\n * Extensions the scanner can actually analyze for inline crypto usage today\n * (the language-specific source detectors). A scan that walked files but found\n * none of these has NOT meaningfully assessed the codebase — reporters surface\n * that ({@link CryptoInventory}/coverage), so a bare 100/100 can't masquerade as\n * \"safe\" on, say, a Go or Rust repo. PEM / SSH / dependency detectors run on any\n * file and are intentionally excluded here.\n */\nexport const ANALYZABLE_SOURCE_EXTENSIONS: readonly string[] = [\n ...JS_TS_EXTENSIONS,\n ...PYTHON_EXTENSIONS,\n ...GO_EXTENSIONS,\n ...JAVA_EXTENSIONS,\n ...CSHARP_EXTENSIONS,\n ...RUST_EXTENSIONS,\n ...RUBY_EXTENSIONS,\n ...C_EXTENSIONS,\n];\n\n/**\n * Human label for the source languages the scanner can analyze for inline\n * crypto, shown in coverage output. Kept next to {@link\n * ANALYZABLE_SOURCE_EXTENSIONS} so a new language pack updates one place.\n */\nexport const ANALYZABLE_LANGUAGES_LABEL = \"JS/TS, Python, Go, Java, C#, Rust, Ruby, C/C++\";\n\n/** True when a path is in a source language the scanner can analyze for crypto. */\nexport function isAnalyzableSource(filePath: string): boolean {\n return hasExtension(filePath, ANALYZABLE_SOURCE_EXTENSIONS);\n}\n\n/**\n * Given a SORTED ascending array of call offsets, return true when `idx` is at\n * or after some call offset `c` with `idx - c < window`. Runs in O(log n) by\n * binary-searching the largest call offset ≤ `idx` and checking the gap. This\n * replaces the previous O(matches × calls) linear scan (`nearCall`).\n */\nexport function nearSortedCall(\n sortedCalls: readonly number[],\n idx: number,\n window: number,\n): boolean {\n // Find the rightmost element <= idx.\n let lo = 0;\n let hi = sortedCalls.length - 1;\n let best = -1;\n while (lo <= hi) {\n const mid = (lo + hi) >>> 1;\n if (sortedCalls[mid] <= idx) {\n best = mid;\n lo = mid + 1;\n } else {\n hi = mid - 1;\n }\n }\n if (best < 0) return false;\n return idx - sortedCalls[best] < window;\n}\n\n/**\n * Run a global regex over `content`, invoking `onMatch` for each hit. Resets\n * lastIndex and guards against zero-width matches (which would loop forever).\n */\nexport function eachMatch(\n re: RegExp,\n content: string,\n onMatch: (match: RegExpExecArray) => void,\n): void {\n const g = re.global ? re : new RegExp(re.source, `${re.flags}g`);\n g.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = g.exec(content)) !== null) {\n onMatch(m);\n if (m.index === g.lastIndex) g.lastIndex++; // avoid infinite loop on empty match\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"detect-utils.js","sourceRoot":"","sources":["../src/detect-utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAQnD;;;;;;;GAOG;AACH,IAAI,aAAa,GAAkB,IAAI,CAAC;AACxC,IAAI,gBAAgB,GAAa,EAAE,CAAC;AACpC,SAAS,aAAa,CAA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C;IAC3B,OAAO,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC1C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,EAAU,EACV,OAAe,EACf,OAAyC;IAEzC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;IACjE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;IAChB,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACtC,OAAO,CAAC,CAAC,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,SAAS;YAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,qCAAqC;IACnF,CAAC;AACH,CAAC","sourcesContent":["/**\n * Shared helpers for the regex-based source detectors: turning a string offset\n * into a 1-based line/column, extracting a trimmed single-line snippet, and a\n * small factory for building Finding objects with consistent remediation text.\n */\nimport type {\n AlgorithmFamily,\n Confidence,\n Finding,\n FindingCategory,\n RuleMeta,\n Severity,\n} from \"./types.js\";\nimport { remediationText } from \"./remediation.js\";\n\n/** A 1-based line/column position derived from a character offset. */\nexport interface LineCol {\n line: number;\n column: number;\n}\n\n/**\n * Memoized line-start offsets for the CURRENT content string. A scan processes\n * all of one file's findings consecutively against the same `content` reference,\n * so a single-entry cache turns the previously O(offset)-per-finding line/column\n * math into O(log n) — the whole file is O(n log n) instead of O(n²). Without\n * this, a large file with many findings scaled quadratically (a real perf cliff,\n * caught by the ReDoS/time-budget test).\n */\nlet cachedContent: string | null = null;\nlet cachedLineStarts: number[] = [];\nfunction lineStartsFor(content: string): number[] {\n if (content === cachedContent) return cachedLineStarts;\n const starts = [0];\n for (let i = 0; i < content.length; i++) {\n if (content.charCodeAt(i) === 10 /* \\n */) starts.push(i + 1);\n }\n cachedContent = content;\n cachedLineStarts = starts;\n return starts;\n}\n\n/** Index of the line containing `offset` (0-based into the line-starts array). */\nfunction lineIndexFor(starts: readonly number[], offset: number): number {\n let lo = 0;\n let hi = starts.length - 1;\n let best = 0;\n while (lo <= hi) {\n const mid = (lo + hi) >>> 1;\n if (starts[mid] <= offset) {\n best = mid;\n lo = mid + 1;\n } else {\n hi = mid - 1;\n }\n }\n return best;\n}\n\n/**\n * Convert a 0-based character offset within `content` into a 1-based\n * line/column. Newlines are LF; CR is treated as an ordinary character, so on\n * CRLF files the column includes the trailing CR offset harmlessly.\n */\nexport function offsetToLineCol(content: string, offset: number): LineCol {\n const starts = lineStartsFor(content);\n const idx = lineIndexFor(starts, offset);\n return { line: idx + 1, column: offset - starts[idx] + 1 };\n}\n\n/** Extract the (trimmed) single source line containing `offset`. */\nexport function lineAt(content: string, offset: number): string {\n const starts = lineStartsFor(content);\n const idx = lineIndexFor(starts, offset);\n const start = starts[idx];\n const nextStart = idx + 1 < starts.length ? starts[idx + 1] : content.length + 1;\n // nextStart points just past the '\\n'; the line content ends before it.\n const end = Math.min(nextStart - 1, content.length);\n return content.slice(start, end).replace(/\\r$/, \"\").trim();\n}\n\n/** Inputs for {@link makeFinding}. */\nexport interface FindingSpec {\n ruleId: string;\n title: string;\n category: FindingCategory;\n severity: Severity;\n confidence: Confidence;\n algorithm?: AlgorithmFamily;\n hndl: boolean;\n message: string;\n /** Override the auto-derived remediation text. */\n remediation?: string;\n /** Associated CWE id (e.g. \"CWE-327\"). */\n cwe?: string;\n /** Marks the matched snippet as the sensitive value itself (key material). */\n sensitive?: boolean;\n /** The matched source text and its start offset within `content`. */\n file: string;\n content: string;\n index: number;\n /** Length of the match, used to compute endLine for multi-line matches. */\n matchLength?: number;\n}\n\n/**\n * Build a {@link Finding} with location info derived from a match offset. When\n * no explicit remediation is given but an algorithm is, the canonical\n * remediation text for that family is used.\n */\nexport function makeFinding(spec: FindingSpec): Finding {\n const { line, column } = offsetToLineCol(spec.content, spec.index);\n const snippet = lineAt(spec.content, spec.index);\n\n const remediation =\n spec.remediation ?? (spec.algorithm ? remediationText(spec.algorithm) : undefined);\n\n const location: Finding[\"location\"] = {\n file: spec.file,\n line,\n column,\n snippet: snippet.length > 200 ? `${snippet.slice(0, 197)}...` : snippet,\n };\n\n if (spec.matchLength && spec.matchLength > 0) {\n const matched = spec.content.slice(spec.index, spec.index + spec.matchLength);\n const extraLines = (matched.match(/\\n/g) ?? []).length;\n if (extraLines > 0) location.endLine = line + extraLines;\n }\n\n const finding: Finding = {\n ruleId: spec.ruleId,\n title: spec.title,\n category: spec.category,\n severity: spec.severity,\n confidence: spec.confidence,\n hndl: spec.hndl,\n message: spec.message,\n location,\n };\n if (spec.algorithm) finding.algorithm = spec.algorithm;\n if (remediation) finding.remediation = remediation;\n if (spec.cwe) finding.cwe = spec.cwe;\n if (spec.sensitive) finding.sensitive = true;\n return finding;\n}\n\n/** Where a match occurred, plus optional per-finding field overrides. */\nexport interface RuleMatch {\n file: string;\n content: string;\n /** Match start offset within `content`. */\n index: number;\n /** Length of the match (used to compute endLine for multi-line matches). */\n matchLength?: number;\n}\n\n/**\n * Fields of a {@link RuleMeta} a detector may refine at match time. Multi-variant\n * rules (e.g. key generation across algorithm families) override these; fixed\n * rules pass none and inherit the catalog metadata verbatim.\n */\nexport type RuleOverrides = Partial<\n Pick<\n RuleMeta,\n \"title\" | \"category\" | \"severity\" | \"confidence\" | \"algorithm\" | \"hndl\" | \"message\" | \"cwe\"\n >\n> & { remediation?: string };\n\n/**\n * Build a {@link Finding} from a rule's catalog metadata plus a match location,\n * applying any per-finding overrides. This is the single construction path for\n * detector findings: the invariant fields (title/severity/category/…) live once\n * in the {@link RuleMeta} declaration, so they can't drift from what the SARIF\n * catalog and the MCP resolver report.\n */\nexport function findingFromRule(rule: RuleMeta, at: RuleMatch, overrides?: RuleOverrides): Finding {\n return makeFinding({\n ruleId: rule.id,\n title: overrides?.title ?? rule.title,\n category: overrides?.category ?? rule.category,\n severity: overrides?.severity ?? rule.severity,\n confidence: overrides?.confidence ?? rule.confidence,\n algorithm: overrides?.algorithm ?? rule.algorithm,\n hndl: overrides?.hndl ?? rule.hndl,\n cwe: overrides?.cwe ?? rule.cwe,\n remediation: overrides?.remediation ?? rule.remediation,\n sensitive: rule.sensitive,\n message: overrides?.message ?? rule.message,\n file: at.file,\n content: at.content,\n index: at.index,\n matchLength: at.matchLength,\n });\n}\n\n/** True if `filePath` has one of the given (lower-case, dotted) extensions. */\nexport function hasExtension(filePath: string, exts: readonly string[]): boolean {\n const lower = filePath.toLowerCase();\n return exts.some((e) => lower.endsWith(e));\n}\n\n/**\n * JavaScript / TypeScript source extensions handled by the source detectors.\n * `.vue` / `.svelte` single-file components embed a `<script>` block, so the\n * lexical detectors catch crypto usage inside them.\n */\nexport const JS_TS_EXTENSIONS: readonly string[] = [\n \".js\",\n \".jsx\",\n \".ts\",\n \".tsx\",\n \".mjs\",\n \".cjs\",\n \".vue\",\n \".svelte\",\n];\n\n/** Python source extensions handled by the Python detector. */\nexport const PYTHON_EXTENSIONS: readonly string[] = [\".py\", \".pyi\", \".pyw\"];\n\n/** Go source extensions handled by the Go detector. */\nexport const GO_EXTENSIONS: readonly string[] = [\".go\"];\n\n/** Java / Kotlin source extensions handled by the JCA detector. */\n// The JVM detector also covers Kotlin (`.kt`/`.kts`) and Scala (`.scala`/`.sc`):\n// all three compile against the same JCA (`KeyPairGenerator`, `Signature`,\n// `KeyAgreement`) and BouncyCastle APIs the Java rules match.\nexport const JAVA_EXTENSIONS: readonly string[] = [\".java\", \".kt\", \".kts\", \".scala\", \".sc\"];\n\n/** C# source extensions handled by the .NET detector. */\nexport const CSHARP_EXTENSIONS: readonly string[] = [\".cs\"];\n\n/** Rust source extensions handled by the Rust detector. */\nexport const RUST_EXTENSIONS: readonly string[] = [\".rs\"];\n\n/** Ruby source extensions handled by the Ruby detector. */\nexport const RUBY_EXTENSIONS: readonly string[] = [\".rb\"];\n\n/** Elixir source extensions handled by the Elixir detector. */\nexport const ELIXIR_EXTENSIONS: readonly string[] = [\".ex\", \".exs\"];\n\n/** PHP source extensions handled by the PHP detector. */\nexport const PHP_EXTENSIONS: readonly string[] = [\".php\", \".phtml\", \".php3\", \".php4\", \".php5\"];\n\n/** C / C++ source extensions handled by the OpenSSL detector. */\nexport const C_EXTENSIONS: readonly string[] = [\".c\", \".h\", \".cc\", \".cpp\", \".cxx\", \".hpp\", \".hh\"];\n\n/**\n * Prose/documentation extensions. The language-agnostic *token* detectors (SSH\n * public keys, TLS cipher suites, certificate signature algorithms) must not run\n * on these: a changelog or README that mentions `ssh-rsa` or `ECDHE-RSA` in a\n * sentence is prose, not crypto config. (PEM/`-----BEGIN` material stays in scope\n * everywhere, so a key pasted into docs is still caught.)\n */\nexport const DOC_EXTENSIONS: readonly string[] = [\n \".md\",\n \".markdown\",\n \".mdown\",\n \".mkd\",\n \".rst\",\n \".adoc\",\n \".asciidoc\",\n \".textile\",\n \".org\",\n \".rdoc\",\n \".pod\",\n];\n\n/**\n * File-literal surfaces where a JWT/JOSE algorithm string (`\"RS256\"`, `\"ES256\"`)\n * is the same evidence regardless of language. Used to un-gate the JWT detector\n * from JS-only. Covers the languages whose JWT libraries pass the alg as a quoted\n * token — JS/TS, Python, Go (`jwt.GetSigningMethod(\"RS256\")`) and Ruby\n * (`JWT.encode(payload, key, 'RS256')`) — so the regex stays precise (`HS*` HMAC\n * tokens are excluded by `RE_JWT_ALG`). Java/C# pass the alg as an *identifier*\n * (`SignatureAlgorithm.RS256`), which needs its own pattern — a later pass.\n * YAML/JSON config carry unquoted tokens and higher FP risk, so they wait too.\n */\nexport const JWT_HOST_EXTENSIONS: readonly string[] = [\n ...JS_TS_EXTENSIONS,\n ...PYTHON_EXTENSIONS,\n ...GO_EXTENSIONS,\n ...RUBY_EXTENSIONS,\n];\n\n/**\n * Extensions the scanner can actually analyze for inline crypto usage today\n * (the language-specific source detectors). A scan that walked files but found\n * none of these has NOT meaningfully assessed the codebase — reporters surface\n * that ({@link CryptoInventory}/coverage), so a bare 100/100 can't masquerade as\n * \"safe\" on, say, a Go or Rust repo. PEM / SSH / dependency detectors run on any\n * file and are intentionally excluded here.\n */\nexport const ANALYZABLE_SOURCE_EXTENSIONS: readonly string[] = [\n ...JS_TS_EXTENSIONS,\n ...PYTHON_EXTENSIONS,\n ...GO_EXTENSIONS,\n ...JAVA_EXTENSIONS,\n ...CSHARP_EXTENSIONS,\n ...RUST_EXTENSIONS,\n ...RUBY_EXTENSIONS,\n ...PHP_EXTENSIONS,\n ...ELIXIR_EXTENSIONS,\n ...C_EXTENSIONS,\n];\n\n/**\n * Human label for the source languages the scanner can analyze for inline\n * crypto, shown in coverage output. Kept next to {@link\n * ANALYZABLE_SOURCE_EXTENSIONS} so a new language pack updates one place.\n */\nexport const ANALYZABLE_LANGUAGES_LABEL =\n \"JS/TS, Python, Go, Java/Kotlin/Scala, C#, Rust, Ruby, PHP, Elixir, C/C++\";\n\n/** True when a path is in a source language the scanner can analyze for crypto. */\nexport function isAnalyzableSource(filePath: string): boolean {\n return hasExtension(filePath, ANALYZABLE_SOURCE_EXTENSIONS);\n}\n\n/**\n * Given a SORTED ascending array of call offsets, return true when `idx` is at\n * or after some call offset `c` with `idx - c < window`. Runs in O(log n) by\n * binary-searching the largest call offset ≤ `idx` and checking the gap. This\n * replaces the previous O(matches × calls) linear scan (`nearCall`).\n */\nexport function nearSortedCall(\n sortedCalls: readonly number[],\n idx: number,\n window: number,\n): boolean {\n // Find the rightmost element <= idx.\n let lo = 0;\n let hi = sortedCalls.length - 1;\n let best = -1;\n while (lo <= hi) {\n const mid = (lo + hi) >>> 1;\n if (sortedCalls[mid] <= idx) {\n best = mid;\n lo = mid + 1;\n } else {\n hi = mid - 1;\n }\n }\n if (best < 0) return false;\n return idx - sortedCalls[best] < window;\n}\n\n/**\n * Run a global regex over `content`, invoking `onMatch` for each hit. Resets\n * lastIndex and guards against zero-width matches (which would loop forever).\n */\nexport function eachMatch(\n re: RegExp,\n content: string,\n onMatch: (match: RegExpExecArray) => void,\n): void {\n const g = re.global ? re : new RegExp(re.source, `${re.flags}g`);\n g.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = g.exec(content)) !== null) {\n onMatch(m);\n if (m.index === g.lastIndex) g.lastIndex++; // avoid infinite loop on empty match\n }\n}\n"]}
|
package/dist/detectors/c.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Source-code detector for classical asymmetric cryptography in C / C++ using
|
|
3
|
-
* OpenSSL (the dominant crypto library for the ecosystem)
|
|
4
|
-
*
|
|
3
|
+
* OpenSSL (the dominant crypto library for the ecosystem), libsodium, and — for
|
|
4
|
+
* the embedded / firmware / IoT niche — Mbed TLS (`mbedtls_*`) and wolfSSL /
|
|
5
|
+
* wolfCrypt (`wc_*`). Lexical, same strategy as the other packs; every library's
|
|
6
|
+
* function names are distinctive enough to keep the false-positive risk low.
|
|
5
7
|
*
|
|
6
8
|
* NOTE: scanning OpenSSL's OWN source/headers will naturally light up (the
|
|
7
9
|
* library declares these symbols) — that is inherent to lexical scanning of a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c.d.ts","sourceRoot":"","sources":["../../src/detectors/c.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"c.d.ts","sourceRoot":"","sources":["../../src/detectors/c.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAqB,MAAM,aAAa,CAAC;AA0b/D,8DAA8D;AAC9D,eAAO,MAAM,SAAS,EAAE,QA4EvB,CAAC"}
|