@quantakrypto/core 0.4.2 → 0.4.3
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/LICENSE +201 -0
- package/README.md +38 -10
- package/dist/agent-types.js.map +1 -1
- package/dist/baseline.js.map +1 -1
- package/dist/cache.js.map +1 -1
- package/dist/cbom.js.map +1 -1
- package/dist/changed.js.map +1 -1
- package/dist/codemods/config-toggle.js.map +1 -1
- package/dist/codemods/registry.js.map +1 -1
- package/dist/comments.d.ts +26 -0
- package/dist/comments.d.ts.map +1 -1
- package/dist/comments.js +141 -1
- package/dist/comments.js.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/cwe.js.map +1 -1
- package/dist/dependencies.d.ts +3 -2
- package/dist/dependencies.d.ts.map +1 -1
- package/dist/dependencies.js +138 -2
- package/dist/dependencies.js.map +1 -1
- package/dist/detect-utils.d.ts +14 -3
- package/dist/detect-utils.d.ts.map +1 -1
- package/dist/detect-utils.js +32 -4
- package/dist/detect-utils.js.map +1 -1
- package/dist/detectors/c.d.ts.map +1 -1
- package/dist/detectors/c.js +190 -2
- package/dist/detectors/c.js.map +1 -1
- package/dist/detectors/csharp.d.ts.map +1 -1
- package/dist/detectors/csharp.js +141 -3
- package/dist/detectors/csharp.js.map +1 -1
- package/dist/detectors/go.d.ts +5 -3
- package/dist/detectors/go.d.ts.map +1 -1
- package/dist/detectors/go.js +187 -3
- package/dist/detectors/go.js.map +1 -1
- package/dist/detectors/java.d.ts.map +1 -1
- package/dist/detectors/java.js +168 -3
- package/dist/detectors/java.js.map +1 -1
- package/dist/detectors/pem.d.ts.map +1 -1
- package/dist/detectors/pem.js +49 -1
- package/dist/detectors/pem.js.map +1 -1
- package/dist/detectors/python.d.ts.map +1 -1
- package/dist/detectors/python.js +74 -3
- package/dist/detectors/python.js.map +1 -1
- package/dist/detectors/ruby.d.ts +9 -5
- package/dist/detectors/ruby.d.ts.map +1 -1
- package/dist/detectors/ruby.js +122 -2
- package/dist/detectors/ruby.js.map +1 -1
- package/dist/detectors/rust.d.ts +8 -3
- package/dist/detectors/rust.d.ts.map +1 -1
- package/dist/detectors/rust.js +185 -3
- package/dist/detectors/rust.js.map +1 -1
- package/dist/detectors/source.d.ts.map +1 -1
- package/dist/detectors/source.js +117 -7
- package/dist/detectors/source.js.map +1 -1
- package/dist/detectors/stateful-hbs.d.ts +22 -0
- package/dist/detectors/stateful-hbs.d.ts.map +1 -0
- package/dist/detectors/stateful-hbs.js +139 -0
- package/dist/detectors/stateful-hbs.js.map +1 -0
- package/dist/errors.js.map +1 -1
- package/dist/evidence.d.ts +48 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +76 -0
- package/dist/evidence.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/inventory.d.ts +2 -0
- package/dist/inventory.d.ts.map +1 -1
- package/dist/inventory.js +27 -1
- package/dist/inventory.js.map +1 -1
- package/dist/parallel.js.map +1 -1
- package/dist/patch-policy.js.map +1 -1
- package/dist/redact.d.ts.map +1 -1
- package/dist/redact.js +39 -0
- package/dist/redact.js.map +1 -1
- package/dist/registry.d.ts +2 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +4 -2
- package/dist/registry.js.map +1 -1
- package/dist/remediate-pipeline.d.ts +3 -0
- package/dist/remediate-pipeline.d.ts.map +1 -1
- package/dist/remediate-pipeline.js +50 -0
- package/dist/remediate-pipeline.js.map +1 -1
- package/dist/remediate-request.js.map +1 -1
- package/dist/remediation.d.ts +9 -3
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +17 -5
- package/dist/remediation.js.map +1 -1
- package/dist/report.d.ts +9 -0
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +31 -0
- package/dist/report.js.map +1 -1
- package/dist/scan-worker.js.map +1 -1
- package/dist/scan.d.ts.map +1 -1
- package/dist/scan.js +8 -1
- package/dist/scan.js.map +1 -1
- package/dist/severity.js.map +1 -1
- package/dist/triage.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/verify.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/dist/walk.js.map +1 -1
- package/dist/worktree.js.map +1 -1
- package/package.json +1 -1
- package/src/comments.ts +140 -1
- package/src/dependencies.ts +143 -4
- package/src/detect-utils.ts +33 -4
- package/src/detectors/c.ts +202 -2
- package/src/detectors/csharp.ts +154 -3
- package/src/detectors/go.ts +209 -6
- package/src/detectors/java.ts +189 -3
- package/src/detectors/pem.ts +53 -1
- package/src/detectors/python.ts +82 -3
- package/src/detectors/ruby.ts +138 -7
- package/src/detectors/rust.ts +211 -7
- package/src/detectors/source.ts +149 -6
- package/src/detectors/stateful-hbs.ts +177 -0
- package/src/evidence.ts +124 -0
- package/src/index.ts +5 -1
- package/src/inventory.ts +31 -1
- package/src/redact.ts +41 -0
- package/src/registry.ts +4 -2
- package/src/remediate-pipeline.ts +55 -0
- package/src/remediation.ts +23 -8
- package/src/report.ts +41 -2
- package/src/scan.ts +13 -1
- package/src/types.ts +1 -1
- package/src/version.ts +1 -1
package/dist/detectors/go.d.ts
CHANGED
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
* `ecdsa.SignASN1`, `ecdh.X25519`, …) are precise, low-false-positive signals.
|
|
7
7
|
*
|
|
8
8
|
* Covered:
|
|
9
|
-
* - crypto/rsa — GenerateKey, EncryptOAEP/PKCS1v15, SignPKCS1v15/PSS
|
|
10
|
-
* - crypto/ecdsa — GenerateKey, Sign/SignASN1
|
|
9
|
+
* - crypto/rsa — GenerateKey, EncryptOAEP/PKCS1v15, SignPKCS1v15/PSS, DecryptOAEP, VerifyPKCS1v15/PSS
|
|
10
|
+
* - crypto/ecdsa — GenerateKey, Sign/SignASN1, Verify/VerifyASN1
|
|
11
11
|
* - crypto/ecdh — P256/P384/P521/X25519 curve construction (key agreement)
|
|
12
|
-
* - crypto/
|
|
12
|
+
* - crypto/elliptic — GenerateKey / ScalarMult (classic pre-1.20 ECDH)
|
|
13
|
+
* - crypto/ed25519 — GenerateKey, Sign, Verify
|
|
13
14
|
* - crypto/dsa — GenerateKey, GenerateParameters (deprecated)
|
|
15
|
+
* - crypto/tls — InsecureSkipVerify, legacy MinVersion (transport config hygiene)
|
|
14
16
|
*
|
|
15
17
|
* HNDL policy mirrors the other detectors: KEM / key agreement (RSA encryption,
|
|
16
18
|
* ECDH) is harvest-now-decrypt-later exposed (hndl:true); signatures (RSA-sign,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go.d.ts","sourceRoot":"","sources":["../../src/detectors/go.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"go.d.ts","sourceRoot":"","sources":["../../src/detectors/go.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAqB,MAAM,aAAa,CAAC;AAqR/D,oFAAoF;AACpF,eAAO,MAAM,UAAU,EAAE,QAoExB,CAAC"}
|
package/dist/detectors/go.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GO_EXTENSIONS, eachMatch, findingFromRule, hasExtension } from "../detect-utils.js";
|
|
2
|
-
import { CWE_BROKEN_CRYPTO } from "../cwe.js";
|
|
2
|
+
import { CWE_BROKEN_CRYPTO, CWE_CERT_VALIDATION, CWE_WEAK_STRENGTH } from "../cwe.js";
|
|
3
3
|
/* -------------------------------------------------------------------------- */
|
|
4
4
|
/* Precompiled regexes (module scope) */
|
|
5
5
|
/* -------------------------------------------------------------------------- */
|
|
@@ -7,9 +7,36 @@ const RE_GO_RSA_KEYGEN = /\brsa\.GenerateKey\s*\(|\brsa\.GenerateMultiPrimeKey\s
|
|
|
7
7
|
const RE_GO_RSA_ENCRYPT = /\brsa\.EncryptOAEP\s*\(|\brsa\.EncryptPKCS1v15\s*\(/g;
|
|
8
8
|
const RE_GO_RSA_SIGN = /\brsa\.SignPKCS1v15\s*\(|\brsa\.SignPSS\s*\(/g;
|
|
9
9
|
const RE_GO_ECDSA = /\becdsa\.GenerateKey\s*\(|\becdsa\.SignASN1\s*\(|\becdsa\.Sign\s*\(/g;
|
|
10
|
-
const RE_GO_ECDH = /\becdh\.(?:P256|P384|P521
|
|
10
|
+
const RE_GO_ECDH = /\becdh\.(?:P256|P384|P521)\s*\(/g;
|
|
11
|
+
// X25519 gets its own family (algorithm "X25519", lower severity) to match how
|
|
12
|
+
// every other pack classifies it — Go was the lone site reporting it as ECDH/high
|
|
13
|
+
// (audit F9). Still key-exchange + hndl:true.
|
|
14
|
+
const RE_GO_X25519 = /\becdh\.X25519\s*\(/g;
|
|
11
15
|
const RE_GO_ED25519 = /\bed25519\.GenerateKey\s*\(|\bed25519\.Sign\s*\(/g;
|
|
12
16
|
const RE_GO_DSA = /\bdsa\.GenerateKey\s*\(|\bdsa\.GenerateParameters\s*\(/g;
|
|
17
|
+
// Verify / decrypt call sites — the inverse operations the Sign/Encrypt/
|
|
18
|
+
// GenerateKey rules above miss today (audit F4/F6). Deliberately disjoint from
|
|
19
|
+
// those rules to avoid double-counting: DecryptOAEP≠EncryptOAEP, Verify*≠Sign*.
|
|
20
|
+
const RE_GO_RSA_DECRYPT = /\brsa\.DecryptOAEP\s*\(/g;
|
|
21
|
+
const RE_GO_RSA_VERIFY = /\brsa\.VerifyPKCS1v15\s*\(|\brsa\.VerifyPSS\s*\(/g;
|
|
22
|
+
const RE_GO_ECDSA_VERIFY = /\becdsa\.Verify(?:ASN1)?\s*\(/g;
|
|
23
|
+
const RE_GO_ED25519_VERIFY = /\bed25519\.Verify\s*\(/g;
|
|
24
|
+
// Classic pre-1.20 elliptic-curve key agreement (crypto/elliptic), superseded by
|
|
25
|
+
// crypto/ecdh but still widespread. GenerateKey + ScalarMult are the low-level
|
|
26
|
+
// ECDH building blocks the crypto/ecdh rule does not see. `.ScalarMult(` is an
|
|
27
|
+
// unqualified method call, so this rule carries medium confidence.
|
|
28
|
+
const RE_GO_ECDH_CLASSIC = /\belliptic\.GenerateKey\s*\(|\.ScalarMult\s*\(/g;
|
|
29
|
+
// Go TLS misconfiguration (crypto/tls). Mirrors the JS tlsDetector: disabled
|
|
30
|
+
// certificate verification and a legacy TLS/SSL version floor.
|
|
31
|
+
const RE_GO_TLS_SKIP_VERIFY = /InsecureSkipVerify:\s*true/g;
|
|
32
|
+
const RE_GO_TLS_LEGACY_VERSION = /MinVersion:\s*tls\.Version(?:TLS1[01]|SSL30)/g;
|
|
33
|
+
// Identifier-form golang-jwt signing methods (audit gap: the quoted "RS256" alg
|
|
34
|
+
// token is caught by the language-agnostic jwt-jose detector, but golang-jwt
|
|
35
|
+
// passes the alg as an EXPORTED IDENTIFIER — `jwt.SigningMethodRS256`,
|
|
36
|
+
// `jwt.SigningMethodES256`, `jwt.SigningMethodEdDSA` — which the string rule
|
|
37
|
+
// misses. RS*/PS* → RSA, ES* → ECDSA, EdDSA → EdDSA. The `\b`s keep it precise:
|
|
38
|
+
// HS* HMAC methods and longer look-alikes (`SigningMethodRS2560`) do not match.
|
|
39
|
+
const RE_GO_JWT_SIGNINGMETHOD = /\bSigningMethod(RS|PS|ES)(?:256|384|512)\b|\bSigningMethodEdDSA\b/g;
|
|
13
40
|
/* -------------------------------------------------------------------------- */
|
|
14
41
|
/* Rule catalog */
|
|
15
42
|
/* -------------------------------------------------------------------------- */
|
|
@@ -66,7 +93,7 @@ const RULE_GO_ECDSA = {
|
|
|
66
93
|
const RULE_GO_ECDH = {
|
|
67
94
|
id: "go-ecdh",
|
|
68
95
|
title: "Go ECDH key exchange",
|
|
69
|
-
description: "crypto/ecdh P256/P384/P521
|
|
96
|
+
description: "crypto/ecdh P256/P384/P521 key agreement",
|
|
70
97
|
category: "key-exchange",
|
|
71
98
|
severity: "high",
|
|
72
99
|
confidence: "high",
|
|
@@ -75,6 +102,18 @@ const RULE_GO_ECDH = {
|
|
|
75
102
|
cwe: CWE_BROKEN_CRYPTO,
|
|
76
103
|
message: "Elliptic-curve Diffie-Hellman (Go crypto/ecdh) is broken by Shor's algorithm (harvest-now-decrypt-later).",
|
|
77
104
|
};
|
|
105
|
+
const RULE_GO_X25519 = {
|
|
106
|
+
id: "go-x25519",
|
|
107
|
+
title: "Go X25519 key exchange",
|
|
108
|
+
description: "crypto/ecdh X25519 key agreement",
|
|
109
|
+
category: "key-exchange",
|
|
110
|
+
severity: "medium",
|
|
111
|
+
confidence: "high",
|
|
112
|
+
algorithm: "X25519",
|
|
113
|
+
hndl: true,
|
|
114
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
115
|
+
message: "X25519 (Go crypto/ecdh) is modern but still classical key agreement — harvest-now-decrypt-later.",
|
|
116
|
+
};
|
|
78
117
|
const RULE_GO_ED25519 = {
|
|
79
118
|
id: "go-ed25519",
|
|
80
119
|
title: "Go Ed25519 signature",
|
|
@@ -100,6 +139,124 @@ const RULE_GO_DSA = {
|
|
|
100
139
|
message: "Classical DSA (Go) is deprecated and forgeable by a quantum attacker.",
|
|
101
140
|
remediation: "Rotate off DSA and migrate to ML-DSA-65 (FIPS 204).",
|
|
102
141
|
};
|
|
142
|
+
const RULE_GO_RSA_DECRYPT = {
|
|
143
|
+
id: "go-rsa-decrypt",
|
|
144
|
+
title: "Go RSA public-key decryption",
|
|
145
|
+
description: "crypto/rsa DecryptOAEP",
|
|
146
|
+
category: "kem",
|
|
147
|
+
severity: "high",
|
|
148
|
+
confidence: "high",
|
|
149
|
+
algorithm: "RSA",
|
|
150
|
+
hndl: true,
|
|
151
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
152
|
+
message: "RSA public-key decryption (Go) recovers data protected by a classical KEM — harvest-now-decrypt-later exposed.",
|
|
153
|
+
};
|
|
154
|
+
const RULE_GO_RSA_VERIFY = {
|
|
155
|
+
id: "go-rsa-verify",
|
|
156
|
+
title: "Go RSA signature verification",
|
|
157
|
+
description: "crypto/rsa VerifyPKCS1v15 / VerifyPSS",
|
|
158
|
+
category: "signature",
|
|
159
|
+
severity: "high",
|
|
160
|
+
confidence: "high",
|
|
161
|
+
algorithm: "RSA",
|
|
162
|
+
hndl: false,
|
|
163
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
164
|
+
message: "Verifies classical RSA signatures (Go), which are forgeable by a quantum attacker.",
|
|
165
|
+
remediation: "ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205)",
|
|
166
|
+
};
|
|
167
|
+
const RULE_GO_ECDSA_VERIFY = {
|
|
168
|
+
id: "go-ecdsa-verify",
|
|
169
|
+
title: "Go ECDSA signature verification",
|
|
170
|
+
description: "crypto/ecdsa Verify / VerifyASN1",
|
|
171
|
+
category: "signature",
|
|
172
|
+
severity: "high",
|
|
173
|
+
confidence: "high",
|
|
174
|
+
algorithm: "ECDSA",
|
|
175
|
+
hndl: false,
|
|
176
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
177
|
+
message: "Verifies classical ECDSA signatures (Go), which are forgeable by a quantum attacker.",
|
|
178
|
+
remediation: "ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205)",
|
|
179
|
+
};
|
|
180
|
+
const RULE_GO_ED25519_VERIFY = {
|
|
181
|
+
id: "go-ed25519-verify",
|
|
182
|
+
title: "Go Ed25519 signature verification",
|
|
183
|
+
description: "crypto/ed25519 Verify",
|
|
184
|
+
category: "signature",
|
|
185
|
+
severity: "low",
|
|
186
|
+
confidence: "high",
|
|
187
|
+
algorithm: "EdDSA",
|
|
188
|
+
hndl: false,
|
|
189
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
190
|
+
message: "Verifies Ed25519 signatures (Go) — modern but still classical and quantum-forgeable.",
|
|
191
|
+
};
|
|
192
|
+
const RULE_GO_ECDH_CLASSIC = {
|
|
193
|
+
id: "go-ecdh-classic",
|
|
194
|
+
title: "Go classic EC key agreement (crypto/elliptic)",
|
|
195
|
+
description: "crypto/elliptic GenerateKey / ScalarMult (pre-1.20 ECDH)",
|
|
196
|
+
category: "key-exchange",
|
|
197
|
+
severity: "high",
|
|
198
|
+
confidence: "medium",
|
|
199
|
+
algorithm: "ECDH",
|
|
200
|
+
hndl: true,
|
|
201
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
202
|
+
message: "Low-level elliptic-curve key agreement (Go crypto/elliptic) is broken by Shor's algorithm (harvest-now-decrypt-later).",
|
|
203
|
+
};
|
|
204
|
+
const RULE_GO_TLS_SKIP_VERIFY = {
|
|
205
|
+
id: "go-tls-insecure-skip-verify",
|
|
206
|
+
title: "Go TLS certificate verification disabled",
|
|
207
|
+
description: "crypto/tls Config InsecureSkipVerify: true",
|
|
208
|
+
category: "tls",
|
|
209
|
+
severity: "high",
|
|
210
|
+
confidence: "high",
|
|
211
|
+
hndl: false,
|
|
212
|
+
cwe: CWE_CERT_VALIDATION,
|
|
213
|
+
message: "InsecureSkipVerify:true disables TLS certificate verification (Go) — MITM risk.",
|
|
214
|
+
remediation: "Remove InsecureSkipVerify:true; verify certificates properly.",
|
|
215
|
+
};
|
|
216
|
+
const RULE_GO_TLS_LEGACY_VERSION = {
|
|
217
|
+
id: "go-tls-legacy-version",
|
|
218
|
+
title: "Go legacy TLS version pinned",
|
|
219
|
+
description: "crypto/tls MinVersion pinned to TLS 1.0/1.1 or SSL 3.0",
|
|
220
|
+
category: "tls",
|
|
221
|
+
severity: "medium",
|
|
222
|
+
confidence: "high",
|
|
223
|
+
hndl: false,
|
|
224
|
+
cwe: CWE_WEAK_STRENGTH,
|
|
225
|
+
message: "MinVersion pins a deprecated TLS/SSL floor (TLS 1.0/1.1 or SSL 3.0) in Go; require TLS 1.3.",
|
|
226
|
+
remediation: "Set MinVersion: tls.VersionTLS13 and prefer PQC-hybrid key exchange.",
|
|
227
|
+
};
|
|
228
|
+
const RULE_GO_JWT_SIGNINGMETHOD = {
|
|
229
|
+
id: "go-jwt-signingmethod",
|
|
230
|
+
title: "Go identifier-form JWT signing method",
|
|
231
|
+
description: "golang-jwt SigningMethodRS/PS/ES* / SigningMethodEdDSA identifier",
|
|
232
|
+
category: "signature",
|
|
233
|
+
severity: "high",
|
|
234
|
+
confidence: "high",
|
|
235
|
+
algorithm: "unknown", // representative umbrella; refined per-match (RSA/ECDSA/EdDSA)
|
|
236
|
+
hndl: false,
|
|
237
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
238
|
+
message: "A classical JWT signature algorithm (Go golang-jwt, identifier form) is used, forgeable by a quantum attacker.",
|
|
239
|
+
remediation: "ML-DSA-65 (FIPS 204); track IETF PQC JOSE/COSE algorithms",
|
|
240
|
+
};
|
|
241
|
+
// The x509 PEM/DER key + certificate layer: parsing/marshalling classical RSA,
|
|
242
|
+
// EC and PKIX key material and X.509 certificates. This is the "handles classical
|
|
243
|
+
// keys" surface the Sign/Verify/GenerateKey rules miss — a key-loading utility
|
|
244
|
+
// (`x509.ParsePKCS8PrivateKey`) touches quantum-vulnerable material without ever
|
|
245
|
+
// naming rsa/ecdsa. Family is ambiguous at the parse site, so `unknown`.
|
|
246
|
+
const RE_GO_X509_PARSE = /\bx509\.(?:ParsePKCS1PrivateKey|ParsePKCS8PrivateKey|ParsePKIXPublicKey|ParseECPrivateKey|ParsePKCS1PublicKey|MarshalPKCS1PrivateKey|MarshalPKCS8PrivateKey|MarshalPKIXPublicKey|MarshalECPrivateKey|ParseCertificates?|ParseCertificateRequest|CreateCertificate|CreateCertificateRequest)\b/g;
|
|
247
|
+
const RULE_GO_X509_PARSE = {
|
|
248
|
+
id: "go-x509-parse",
|
|
249
|
+
title: "Go x509 classical key/certificate handling",
|
|
250
|
+
description: "x509.Parse*/Marshal*/Create* for RSA/EC/PKIX keys and X.509 certificates",
|
|
251
|
+
category: "certificate",
|
|
252
|
+
severity: "medium",
|
|
253
|
+
confidence: "medium",
|
|
254
|
+
algorithm: "unknown",
|
|
255
|
+
hndl: false,
|
|
256
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
257
|
+
message: "This code parses/marshals classical asymmetric key or X.509 certificate material (x509.*), a quantum forgery/harvest surface.",
|
|
258
|
+
remediation: "Inventory the key/cert types handled here; plan PQC (ML-DSA) certificate + key migration.",
|
|
259
|
+
};
|
|
103
260
|
/** Detects classical asymmetric crypto in Go source (crypto/* standard library). */
|
|
104
261
|
export const goDetector = {
|
|
105
262
|
id: "go-crypto",
|
|
@@ -112,8 +269,18 @@ export const goDetector = {
|
|
|
112
269
|
RULE_GO_RSA_SIGN,
|
|
113
270
|
RULE_GO_ECDSA,
|
|
114
271
|
RULE_GO_ECDH,
|
|
272
|
+
RULE_GO_X25519,
|
|
115
273
|
RULE_GO_ED25519,
|
|
116
274
|
RULE_GO_DSA,
|
|
275
|
+
RULE_GO_RSA_DECRYPT,
|
|
276
|
+
RULE_GO_RSA_VERIFY,
|
|
277
|
+
RULE_GO_ECDSA_VERIFY,
|
|
278
|
+
RULE_GO_ED25519_VERIFY,
|
|
279
|
+
RULE_GO_ECDH_CLASSIC,
|
|
280
|
+
RULE_GO_TLS_SKIP_VERIFY,
|
|
281
|
+
RULE_GO_TLS_LEGACY_VERSION,
|
|
282
|
+
RULE_GO_JWT_SIGNINGMETHOD,
|
|
283
|
+
RULE_GO_X509_PARSE,
|
|
117
284
|
],
|
|
118
285
|
appliesTo: (f) => hasExtension(f, GO_EXTENSIONS),
|
|
119
286
|
detect({ file, content }) {
|
|
@@ -124,8 +291,25 @@ export const goDetector = {
|
|
|
124
291
|
add(RE_GO_RSA_SIGN, RULE_GO_RSA_SIGN);
|
|
125
292
|
add(RE_GO_ECDSA, RULE_GO_ECDSA);
|
|
126
293
|
add(RE_GO_ECDH, RULE_GO_ECDH);
|
|
294
|
+
add(RE_GO_X25519, RULE_GO_X25519);
|
|
127
295
|
add(RE_GO_ED25519, RULE_GO_ED25519);
|
|
128
296
|
add(RE_GO_DSA, RULE_GO_DSA);
|
|
297
|
+
add(RE_GO_RSA_DECRYPT, RULE_GO_RSA_DECRYPT);
|
|
298
|
+
add(RE_GO_RSA_VERIFY, RULE_GO_RSA_VERIFY);
|
|
299
|
+
add(RE_GO_ECDSA_VERIFY, RULE_GO_ECDSA_VERIFY);
|
|
300
|
+
add(RE_GO_ED25519_VERIFY, RULE_GO_ED25519_VERIFY);
|
|
301
|
+
add(RE_GO_ECDH_CLASSIC, RULE_GO_ECDH_CLASSIC);
|
|
302
|
+
add(RE_GO_TLS_SKIP_VERIFY, RULE_GO_TLS_SKIP_VERIFY);
|
|
303
|
+
add(RE_GO_TLS_LEGACY_VERSION, RULE_GO_TLS_LEGACY_VERSION);
|
|
304
|
+
add(RE_GO_X509_PARSE, RULE_GO_X509_PARSE);
|
|
305
|
+
// Identifier-form golang-jwt signing methods (jwt.SigningMethodRS256, …).
|
|
306
|
+
// Refine the umbrella "unknown" algorithm per match: m[1] is the RS/PS/ES
|
|
307
|
+
// prefix (RS/PS → RSA, ES → ECDSA); when it is undefined the EdDSA branch
|
|
308
|
+
// matched, so the family is EdDSA.
|
|
309
|
+
eachMatch(RE_GO_JWT_SIGNINGMETHOD, content, (m) => {
|
|
310
|
+
const algorithm = m[1] === "ES" ? "ECDSA" : m[1] ? "RSA" : "EdDSA";
|
|
311
|
+
findings.push(findingFromRule(RULE_GO_JWT_SIGNINGMETHOD, { file, content, index: m.index, matchLength: m[0].length }, { algorithm }));
|
|
312
|
+
});
|
|
129
313
|
return findings;
|
|
130
314
|
},
|
|
131
315
|
};
|
package/dist/detectors/go.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../src/detectors/go.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,MAAM,gBAAgB,GAAG,4DA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E,CACd,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC","sourcesContent":["/**\n * Source-code detector for classical, non-quantum-safe asymmetric cryptography\n * in Go. Same lexical (regex-over-source) strategy as the JS/TS and Python\n * detectors. Go's crypto lives almost entirely in the highly-standardized\n * `crypto/*` standard library, so package-qualified calls (`rsa.GenerateKey`,\n * `ecdsa.SignASN1`, `ecdh.X25519`, …) are precise, low-false-positive signals.\n *\n * Covered:\n * - crypto/rsa — GenerateKey, EncryptOAEP/PKCS1v15, SignPKCS1v15/PSS, DecryptOAEP, VerifyPKCS1v15/PSS\n * - crypto/ecdsa — GenerateKey, Sign/SignASN1, Verify/VerifyASN1\n * - crypto/ecdh — P256/P384/P521/X25519 curve construction (key agreement)\n * - crypto/elliptic — GenerateKey / ScalarMult (classic pre-1.20 ECDH)\n * - crypto/ed25519 — GenerateKey, Sign, Verify\n * - crypto/dsa — GenerateKey, GenerateParameters (deprecated)\n * - crypto/tls — InsecureSkipVerify, legacy MinVersion (transport config hygiene)\n *\n * HNDL policy mirrors the other detectors: KEM / key agreement (RSA encryption,\n * ECDH) is harvest-now-decrypt-later exposed (hndl:true); signatures (RSA-sign,\n * ECDSA, Ed25519, DSA) are hndl:false but still forgeable by a quantum attacker.\n * Unlike Node's ambiguous `'ec'` keygen, Go's `ecdsa.GenerateKey` is\n * signature-specific and Go's key agreement lives in the separate `crypto/ecdh`\n * package, so the two are classified precisely rather than conservatively merged.\n */\nimport type { Detector, Finding, RuleMeta } from \"../types.js\";\nimport { GO_EXTENSIONS, eachMatch, findingFromRule, hasExtension } from \"../detect-utils.js\";\nimport { CWE_BROKEN_CRYPTO, CWE_CERT_VALIDATION, CWE_WEAK_STRENGTH } from \"../cwe.js\";\n\n/* -------------------------------------------------------------------------- */\n/* Precompiled regexes (module scope) */\n/* -------------------------------------------------------------------------- */\n\nconst RE_GO_RSA_KEYGEN = /\\brsa\\.GenerateKey\\s*\\(|\\brsa\\.GenerateMultiPrimeKey\\s*\\(/g;\nconst RE_GO_RSA_ENCRYPT = /\\brsa\\.EncryptOAEP\\s*\\(|\\brsa\\.EncryptPKCS1v15\\s*\\(/g;\nconst RE_GO_RSA_SIGN = /\\brsa\\.SignPKCS1v15\\s*\\(|\\brsa\\.SignPSS\\s*\\(/g;\nconst RE_GO_ECDSA = /\\becdsa\\.GenerateKey\\s*\\(|\\becdsa\\.SignASN1\\s*\\(|\\becdsa\\.Sign\\s*\\(/g;\nconst RE_GO_ECDH = /\\becdh\\.(?:P256|P384|P521)\\s*\\(/g;\n// X25519 gets its own family (algorithm \"X25519\", lower severity) to match how\n// every other pack classifies it — Go was the lone site reporting it as ECDH/high\n// (audit F9). Still key-exchange + hndl:true.\nconst RE_GO_X25519 = /\\becdh\\.X25519\\s*\\(/g;\nconst RE_GO_ED25519 = /\\bed25519\\.GenerateKey\\s*\\(|\\bed25519\\.Sign\\s*\\(/g;\nconst RE_GO_DSA = /\\bdsa\\.GenerateKey\\s*\\(|\\bdsa\\.GenerateParameters\\s*\\(/g;\n// Verify / decrypt call sites — the inverse operations the Sign/Encrypt/\n// GenerateKey rules above miss today (audit F4/F6). Deliberately disjoint from\n// those rules to avoid double-counting: DecryptOAEP≠EncryptOAEP, Verify*≠Sign*.\nconst RE_GO_RSA_DECRYPT = /\\brsa\\.DecryptOAEP\\s*\\(/g;\nconst RE_GO_RSA_VERIFY = /\\brsa\\.VerifyPKCS1v15\\s*\\(|\\brsa\\.VerifyPSS\\s*\\(/g;\nconst RE_GO_ECDSA_VERIFY = /\\becdsa\\.Verify(?:ASN1)?\\s*\\(/g;\nconst RE_GO_ED25519_VERIFY = /\\bed25519\\.Verify\\s*\\(/g;\n// Classic pre-1.20 elliptic-curve key agreement (crypto/elliptic), superseded by\n// crypto/ecdh but still widespread. GenerateKey + ScalarMult are the low-level\n// ECDH building blocks the crypto/ecdh rule does not see. `.ScalarMult(` is an\n// unqualified method call, so this rule carries medium confidence.\nconst RE_GO_ECDH_CLASSIC = /\\belliptic\\.GenerateKey\\s*\\(|\\.ScalarMult\\s*\\(/g;\n// Go TLS misconfiguration (crypto/tls). Mirrors the JS tlsDetector: disabled\n// certificate verification and a legacy TLS/SSL version floor.\nconst RE_GO_TLS_SKIP_VERIFY = /InsecureSkipVerify:\\s*true/g;\nconst RE_GO_TLS_LEGACY_VERSION = /MinVersion:\\s*tls\\.Version(?:TLS1[01]|SSL30)/g;\n// Identifier-form golang-jwt signing methods (audit gap: the quoted \"RS256\" alg\n// token is caught by the language-agnostic jwt-jose detector, but golang-jwt\n// passes the alg as an EXPORTED IDENTIFIER — `jwt.SigningMethodRS256`,\n// `jwt.SigningMethodES256`, `jwt.SigningMethodEdDSA` — which the string rule\n// misses. RS*/PS* → RSA, ES* → ECDSA, EdDSA → EdDSA. The `\\b`s keep it precise:\n// HS* HMAC methods and longer look-alikes (`SigningMethodRS2560`) do not match.\nconst RE_GO_JWT_SIGNINGMETHOD =\n /\\bSigningMethod(RS|PS|ES)(?:256|384|512)\\b|\\bSigningMethodEdDSA\\b/g;\n\n/* -------------------------------------------------------------------------- */\n/* Rule catalog */\n/* -------------------------------------------------------------------------- */\n\nconst RULE_GO_RSA_KEYGEN: RuleMeta = {\n id: \"go-rsa-keygen\",\n title: \"Go RSA key generation\",\n description: \"crypto/rsa GenerateKey / GenerateMultiPrimeKey\",\n category: \"kem\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Generates a classical RSA key pair (Go), which is not quantum-safe.\",\n};\nconst RULE_GO_RSA_ENCRYPT: RuleMeta = {\n id: \"go-rsa-encrypt\",\n title: \"Go RSA public-key encryption\",\n description: \"crypto/rsa EncryptOAEP / EncryptPKCS1v15\",\n category: \"kem\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"RSA public-key encryption (Go) is broken by Shor's algorithm and exposed to harvest-now-decrypt-later.\",\n};\nconst RULE_GO_RSA_SIGN: RuleMeta = {\n id: \"go-rsa-sign\",\n title: \"Go RSA signature\",\n description: \"crypto/rsa SignPKCS1v15 / SignPSS\",\n category: \"signature\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Classical RSA signing (Go) is forgeable by a quantum attacker.\",\n remediation: \"ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205)\",\n};\nconst RULE_GO_ECDSA: RuleMeta = {\n id: \"go-ecdsa\",\n title: \"Go ECDSA key/signature\",\n description: \"crypto/ecdsa GenerateKey / Sign / SignASN1\",\n category: \"signature\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"ECDSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Classical ECDSA (Go) is forgeable by a quantum attacker.\",\n remediation: \"ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205)\",\n};\nconst RULE_GO_ECDH: RuleMeta = {\n id: \"go-ecdh\",\n title: \"Go ECDH key exchange\",\n description: \"crypto/ecdh P256/P384/P521 key agreement\",\n category: \"key-exchange\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"ECDH\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Elliptic-curve Diffie-Hellman (Go crypto/ecdh) is broken by Shor's algorithm (harvest-now-decrypt-later).\",\n};\nconst RULE_GO_X25519: RuleMeta = {\n id: \"go-x25519\",\n title: \"Go X25519 key exchange\",\n description: \"crypto/ecdh X25519 key agreement\",\n category: \"key-exchange\",\n severity: \"medium\",\n confidence: \"high\",\n algorithm: \"X25519\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"X25519 (Go crypto/ecdh) is modern but still classical key agreement — harvest-now-decrypt-later.\",\n};\nconst RULE_GO_ED25519: RuleMeta = {\n id: \"go-ed25519\",\n title: \"Go Ed25519 signature\",\n description: \"crypto/ed25519 GenerateKey / Sign\",\n category: \"signature\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"EdDSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Ed25519 (Go) is a modern but still classical signature scheme.\",\n};\nconst RULE_GO_DSA: RuleMeta = {\n id: \"go-dsa\",\n title: \"Go DSA key/usage\",\n description: \"crypto/dsa GenerateKey / GenerateParameters\",\n category: \"signature\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"DSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Classical DSA (Go) is deprecated and forgeable by a quantum attacker.\",\n remediation: \"Rotate off DSA and migrate to ML-DSA-65 (FIPS 204).\",\n};\nconst RULE_GO_RSA_DECRYPT: RuleMeta = {\n id: \"go-rsa-decrypt\",\n title: \"Go RSA public-key decryption\",\n description: \"crypto/rsa DecryptOAEP\",\n category: \"kem\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"RSA public-key decryption (Go) recovers data protected by a classical KEM — harvest-now-decrypt-later exposed.\",\n};\nconst RULE_GO_RSA_VERIFY: RuleMeta = {\n id: \"go-rsa-verify\",\n title: \"Go RSA signature verification\",\n description: \"crypto/rsa VerifyPKCS1v15 / VerifyPSS\",\n category: \"signature\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Verifies classical RSA signatures (Go), which are forgeable by a quantum attacker.\",\n remediation: \"ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205)\",\n};\nconst RULE_GO_ECDSA_VERIFY: RuleMeta = {\n id: \"go-ecdsa-verify\",\n title: \"Go ECDSA signature verification\",\n description: \"crypto/ecdsa Verify / VerifyASN1\",\n category: \"signature\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"ECDSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Verifies classical ECDSA signatures (Go), which are forgeable by a quantum attacker.\",\n remediation: \"ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205)\",\n};\nconst RULE_GO_ED25519_VERIFY: RuleMeta = {\n id: \"go-ed25519-verify\",\n title: \"Go Ed25519 signature verification\",\n description: \"crypto/ed25519 Verify\",\n category: \"signature\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"EdDSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Verifies Ed25519 signatures (Go) — modern but still classical and quantum-forgeable.\",\n};\nconst RULE_GO_ECDH_CLASSIC: RuleMeta = {\n id: \"go-ecdh-classic\",\n title: \"Go classic EC key agreement (crypto/elliptic)\",\n description: \"crypto/elliptic GenerateKey / ScalarMult (pre-1.20 ECDH)\",\n category: \"key-exchange\",\n severity: \"high\",\n confidence: \"medium\",\n algorithm: \"ECDH\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Low-level elliptic-curve key agreement (Go crypto/elliptic) is broken by Shor's algorithm (harvest-now-decrypt-later).\",\n};\nconst RULE_GO_TLS_SKIP_VERIFY: RuleMeta = {\n id: \"go-tls-insecure-skip-verify\",\n title: \"Go TLS certificate verification disabled\",\n description: \"crypto/tls Config InsecureSkipVerify: true\",\n category: \"tls\",\n severity: \"high\",\n confidence: \"high\",\n hndl: false,\n cwe: CWE_CERT_VALIDATION,\n message: \"InsecureSkipVerify:true disables TLS certificate verification (Go) — MITM risk.\",\n remediation: \"Remove InsecureSkipVerify:true; verify certificates properly.\",\n};\nconst RULE_GO_TLS_LEGACY_VERSION: RuleMeta = {\n id: \"go-tls-legacy-version\",\n title: \"Go legacy TLS version pinned\",\n description: \"crypto/tls MinVersion pinned to TLS 1.0/1.1 or SSL 3.0\",\n category: \"tls\",\n severity: \"medium\",\n confidence: \"high\",\n hndl: false,\n cwe: CWE_WEAK_STRENGTH,\n message:\n \"MinVersion pins a deprecated TLS/SSL floor (TLS 1.0/1.1 or SSL 3.0) in Go; require TLS 1.3.\",\n remediation: \"Set MinVersion: tls.VersionTLS13 and prefer PQC-hybrid key exchange.\",\n};\nconst RULE_GO_JWT_SIGNINGMETHOD: RuleMeta = {\n id: \"go-jwt-signingmethod\",\n title: \"Go identifier-form JWT signing method\",\n description: \"golang-jwt SigningMethodRS/PS/ES* / SigningMethodEdDSA identifier\",\n category: \"signature\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"unknown\", // representative umbrella; refined per-match (RSA/ECDSA/EdDSA)\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"A classical JWT signature algorithm (Go golang-jwt, identifier form) is used, forgeable by a quantum attacker.\",\n remediation: \"ML-DSA-65 (FIPS 204); track IETF PQC JOSE/COSE algorithms\",\n};\n\n// The x509 PEM/DER key + certificate layer: parsing/marshalling classical RSA,\n// EC and PKIX key material and X.509 certificates. This is the \"handles classical\n// keys\" surface the Sign/Verify/GenerateKey rules miss — a key-loading utility\n// (`x509.ParsePKCS8PrivateKey`) touches quantum-vulnerable material without ever\n// naming rsa/ecdsa. Family is ambiguous at the parse site, so `unknown`.\nconst RE_GO_X509_PARSE =\n /\\bx509\\.(?:ParsePKCS1PrivateKey|ParsePKCS8PrivateKey|ParsePKIXPublicKey|ParseECPrivateKey|ParsePKCS1PublicKey|MarshalPKCS1PrivateKey|MarshalPKCS8PrivateKey|MarshalPKIXPublicKey|MarshalECPrivateKey|ParseCertificates?|ParseCertificateRequest|CreateCertificate|CreateCertificateRequest)\\b/g;\nconst RULE_GO_X509_PARSE: RuleMeta = {\n id: \"go-x509-parse\",\n title: \"Go x509 classical key/certificate handling\",\n description: \"x509.Parse*/Marshal*/Create* for RSA/EC/PKIX keys and X.509 certificates\",\n category: \"certificate\",\n severity: \"medium\",\n confidence: \"medium\",\n algorithm: \"unknown\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"This code parses/marshals classical asymmetric key or X.509 certificate material (x509.*), a quantum forgery/harvest surface.\",\n remediation:\n \"Inventory the key/cert types handled here; plan PQC (ML-DSA) certificate + key migration.\",\n};\n\n/** Detects classical asymmetric crypto in Go source (crypto/* standard library). */\nexport const goDetector: Detector = {\n id: \"go-crypto\",\n description: \"Classical asymmetric crypto in Go (crypto/rsa, ecdsa, ecdh, ed25519, dsa)\",\n scope: \"source\",\n language: \"go\",\n rules: [\n RULE_GO_RSA_KEYGEN,\n RULE_GO_RSA_ENCRYPT,\n RULE_GO_RSA_SIGN,\n RULE_GO_ECDSA,\n RULE_GO_ECDH,\n RULE_GO_X25519,\n RULE_GO_ED25519,\n RULE_GO_DSA,\n RULE_GO_RSA_DECRYPT,\n RULE_GO_RSA_VERIFY,\n RULE_GO_ECDSA_VERIFY,\n RULE_GO_ED25519_VERIFY,\n RULE_GO_ECDH_CLASSIC,\n RULE_GO_TLS_SKIP_VERIFY,\n RULE_GO_TLS_LEGACY_VERSION,\n RULE_GO_JWT_SIGNINGMETHOD,\n RULE_GO_X509_PARSE,\n ],\n appliesTo: (f) => hasExtension(f, GO_EXTENSIONS),\n detect({ file, content }): Finding[] {\n const findings: Finding[] = [];\n const add = (re: RegExp, rule: RuleMeta) =>\n eachMatch(re, content, (m) =>\n findings.push(\n findingFromRule(rule, { file, content, index: m.index, matchLength: m[0].length }),\n ),\n );\n\n add(RE_GO_RSA_KEYGEN, RULE_GO_RSA_KEYGEN);\n add(RE_GO_RSA_ENCRYPT, RULE_GO_RSA_ENCRYPT);\n add(RE_GO_RSA_SIGN, RULE_GO_RSA_SIGN);\n add(RE_GO_ECDSA, RULE_GO_ECDSA);\n add(RE_GO_ECDH, RULE_GO_ECDH);\n add(RE_GO_X25519, RULE_GO_X25519);\n add(RE_GO_ED25519, RULE_GO_ED25519);\n add(RE_GO_DSA, RULE_GO_DSA);\n add(RE_GO_RSA_DECRYPT, RULE_GO_RSA_DECRYPT);\n add(RE_GO_RSA_VERIFY, RULE_GO_RSA_VERIFY);\n add(RE_GO_ECDSA_VERIFY, RULE_GO_ECDSA_VERIFY);\n add(RE_GO_ED25519_VERIFY, RULE_GO_ED25519_VERIFY);\n add(RE_GO_ECDH_CLASSIC, RULE_GO_ECDH_CLASSIC);\n add(RE_GO_TLS_SKIP_VERIFY, RULE_GO_TLS_SKIP_VERIFY);\n add(RE_GO_TLS_LEGACY_VERSION, RULE_GO_TLS_LEGACY_VERSION);\n add(RE_GO_X509_PARSE, RULE_GO_X509_PARSE);\n\n // Identifier-form golang-jwt signing methods (jwt.SigningMethodRS256, …).\n // Refine the umbrella \"unknown\" algorithm per match: m[1] is the RS/PS/ES\n // prefix (RS/PS → RSA, ES → ECDSA); when it is undefined the EdDSA branch\n // matched, so the family is EdDSA.\n eachMatch(RE_GO_JWT_SIGNINGMETHOD, content, (m) => {\n const algorithm: Finding[\"algorithm\"] = m[1] === \"ES\" ? \"ECDSA\" : m[1] ? \"RSA\" : \"EdDSA\";\n findings.push(\n findingFromRule(\n RULE_GO_JWT_SIGNINGMETHOD,\n { file, content, index: m.index, matchLength: m[0].length },\n { algorithm },\n ),\n );\n });\n\n return findings;\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"java.d.ts","sourceRoot":"","sources":["../../src/detectors/java.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAqB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"java.d.ts","sourceRoot":"","sources":["../../src/detectors/java.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAqB,MAAM,aAAa,CAAC;AAkT/D,iFAAiF;AACjF,eAAO,MAAM,YAAY,EAAE,QA4F1B,CAAC"}
|
package/dist/detectors/java.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JAVA_EXTENSIONS, eachMatch, findingFromRule, hasExtension } from "../detect-utils.js";
|
|
2
|
-
import { CWE_BROKEN_CRYPTO } from "../cwe.js";
|
|
2
|
+
import { CWE_BROKEN_CRYPTO, CWE_CERT_VALIDATION, CWE_WEAK_STRENGTH } from "../cwe.js";
|
|
3
3
|
/* -------------------------------------------------------------------------- */
|
|
4
4
|
/* Regexes */
|
|
5
5
|
/* -------------------------------------------------------------------------- */
|
|
@@ -8,7 +8,29 @@ import { CWE_BROKEN_CRYPTO } from "../cwe.js";
|
|
|
8
8
|
// are symmetric / hashing only).
|
|
9
9
|
const RE_JAVA_GETINSTANCE = /\b(KeyPairGenerator|Signature|Cipher|KeyAgreement|KeyFactory)\s*\.\s*getInstance\s*\(\s*"([^"]+)"/g;
|
|
10
10
|
// BouncyCastle lightweight-API class instantiations.
|
|
11
|
-
const RE_JAVA_BC = /\bnew\s+(RSAKeyPairGenerator|DSAKeyPairGenerator|ECKeyPairGenerator|ECDSASigner|Ed25519Signer|Ed448Signer|X25519Agreement|X448Agreement)\s*\(/g;
|
|
11
|
+
const RE_JAVA_BC = /\bnew\s+(RSAKeyPairGenerator|DSAKeyPairGenerator|ECKeyPairGenerator|ECDSASigner|Ed25519Signer|Ed448Signer|X25519Agreement|X448Agreement|ECDHBasicAgreement|DHBasicAgreement|X25519KeyPairGenerator|Ed25519KeyPairGenerator|RSAEngine|OAEPEncoding)\s*\(/g;
|
|
12
|
+
// BouncyCastle lightweight-API curve/EdDSA classes as a BARE constructor call —
|
|
13
|
+
// the Kotlin form (`X448KeyPairGenerator()`, no `new` keyword). RE_JAVA_BC above
|
|
14
|
+
// only matches the Java `new <Class>(` form, so Kotlin sources that drive the
|
|
15
|
+
// lightweight API directly are missed. The negative lookbehind `(?<!\bnew\s+)`
|
|
16
|
+
// keeps this additive: `new X448Agreement(` stays with RE_JAVA_BC (java-xdh),
|
|
17
|
+
// while bare `X448Agreement(` routes to the family-specific rules below. Scoped
|
|
18
|
+
// to the exact X448/X25519/Ed448/Ed25519 class names to stay precise.
|
|
19
|
+
const RE_JAVA_BC_CURVE = /(?<!\bnew\s+)\b(X448KeyPairGenerator|X448Agreement|X448PrivateKeyParameters|X25519KeyPairGenerator|X25519Agreement|Ed448KeyPairGenerator|Ed448Signer|Ed25519KeyPairGenerator|Ed25519Signer)\s*\(/g;
|
|
20
|
+
// Insecure JSSE / TLS configuration expressed in Java source. Mirrors the JS
|
|
21
|
+
// tlsDetector in source.ts (category "tls"): a legacy SSL/TLS protocol version
|
|
22
|
+
// requested from SSLContext, and TLS hostname verification neutered via an
|
|
23
|
+
// all-trusting verifier (Apache HttpClient's NoopHostnameVerifier /
|
|
24
|
+
// ALLOW_ALL_HOSTNAME_VERIFIER).
|
|
25
|
+
const RE_JAVA_TLS_LEGACY = /\bSSLContext\s*\.\s*getInstance\s*\(\s*"(SSL|SSLv3|TLSv1)"/g;
|
|
26
|
+
const RE_JAVA_TLS_NOVERIFY = /\b(NoopHostnameVerifier|ALLOW_ALL_HOSTNAME_VERIFIER)\b/g;
|
|
27
|
+
// Identifier-form JWT/JOSE signature algorithms (audit F7). The quoted-string
|
|
28
|
+
// alg token ("RS256") is caught by the language-agnostic jwt-jose detector, but
|
|
29
|
+
// the Java JWT libraries pass the alg as an IDENTIFIER, not a string literal:
|
|
30
|
+
// jjwt's `SignatureAlgorithm.RS256` and auth0 java-jwt's `Algorithm.RSA256` /
|
|
31
|
+
// `Algorithm.ECDSA256`. ("SignatureAlgorithm" has no word boundary before its
|
|
32
|
+
// "Algorithm", so the auth0 branch cannot re-match the jjwt form.)
|
|
33
|
+
const RE_JAVA_JWT_ALG = /\bSignatureAlgorithm\.(?:RS|PS|ES)(?:256|384|512)\b|\bAlgorithm\.(?:RSA|ECDSA)(?:256|384|512)\b/g;
|
|
12
34
|
/* -------------------------------------------------------------------------- */
|
|
13
35
|
/* Rule catalog */
|
|
14
36
|
/* -------------------------------------------------------------------------- */
|
|
@@ -105,7 +127,7 @@ const RULE_JAVA_XDH = {
|
|
|
105
127
|
title: "Java X25519/X448 key agreement",
|
|
106
128
|
description: "JCA XDH / X25519 / X448 (KeyPairGenerator / KeyAgreement)",
|
|
107
129
|
category: "key-exchange",
|
|
108
|
-
severity: "
|
|
130
|
+
severity: "medium",
|
|
109
131
|
confidence: "high",
|
|
110
132
|
algorithm: "X25519",
|
|
111
133
|
hndl: true,
|
|
@@ -124,6 +146,82 @@ const RULE_JAVA_EDDSA = {
|
|
|
124
146
|
cwe: CWE_BROKEN_CRYPTO,
|
|
125
147
|
message: "Ed25519/Ed448 (Java/JCA) is a modern but still classical signature scheme.",
|
|
126
148
|
};
|
|
149
|
+
// BouncyCastle lightweight-API rules for bare (Kotlin-form) constructor calls.
|
|
150
|
+
// Split by family so X448 and X25519 report their own algorithm string (java-xdh
|
|
151
|
+
// lumps both under "X25519"). Severity/CWE copied from the JCA siblings above.
|
|
152
|
+
const RULE_JAVA_BC_X448 = {
|
|
153
|
+
id: "java-bc-x448",
|
|
154
|
+
title: "Java/Kotlin X448 key agreement (BouncyCastle lightweight API)",
|
|
155
|
+
description: "BouncyCastle X448KeyPairGenerator / X448Agreement / X448PrivateKeyParameters",
|
|
156
|
+
category: "key-exchange",
|
|
157
|
+
severity: "medium",
|
|
158
|
+
confidence: "high",
|
|
159
|
+
algorithm: "X448",
|
|
160
|
+
hndl: true,
|
|
161
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
162
|
+
message: "X448 (Java/Kotlin, BouncyCastle lightweight API) is modern but still classical key agreement — harvest-now-decrypt-later.",
|
|
163
|
+
};
|
|
164
|
+
const RULE_JAVA_BC_X25519 = {
|
|
165
|
+
id: "java-bc-x25519",
|
|
166
|
+
title: "Java/Kotlin X25519 key agreement (BouncyCastle lightweight API)",
|
|
167
|
+
description: "BouncyCastle X25519KeyPairGenerator / X25519Agreement",
|
|
168
|
+
category: "key-exchange",
|
|
169
|
+
severity: "medium",
|
|
170
|
+
confidence: "high",
|
|
171
|
+
algorithm: "X25519",
|
|
172
|
+
hndl: true,
|
|
173
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
174
|
+
message: "X25519 (Java/Kotlin, BouncyCastle lightweight API) is modern but still classical key agreement — harvest-now-decrypt-later.",
|
|
175
|
+
};
|
|
176
|
+
const RULE_JAVA_BC_EDDSA = {
|
|
177
|
+
id: "java-bc-eddsa",
|
|
178
|
+
title: "Java/Kotlin Ed25519/Ed448 signature (BouncyCastle lightweight API)",
|
|
179
|
+
description: "BouncyCastle Ed448KeyPairGenerator / Ed448Signer / Ed25519KeyPairGenerator / Ed25519Signer",
|
|
180
|
+
category: "signature",
|
|
181
|
+
severity: "low",
|
|
182
|
+
confidence: "high",
|
|
183
|
+
algorithm: "EdDSA",
|
|
184
|
+
hndl: false,
|
|
185
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
186
|
+
message: "Ed25519/Ed448 (Java/Kotlin, BouncyCastle lightweight API) is a modern but still classical signature scheme.",
|
|
187
|
+
};
|
|
188
|
+
const RULE_JAVA_TLS_LEGACY = {
|
|
189
|
+
id: "java-tls-legacy-version",
|
|
190
|
+
title: "Legacy SSL/TLS version requested",
|
|
191
|
+
description: 'SSLContext.getInstance("SSL" | "SSLv3" | "TLSv1")',
|
|
192
|
+
category: "tls",
|
|
193
|
+
severity: "medium",
|
|
194
|
+
confidence: "high",
|
|
195
|
+
hndl: false,
|
|
196
|
+
cwe: CWE_WEAK_STRENGTH,
|
|
197
|
+
message: "SSL/SSLv3/TLS 1.0 are deprecated and insecure (Java/JSSE); require TLS 1.3.",
|
|
198
|
+
remediation: 'Use SSLContext.getInstance("TLSv1.3") and prefer PQC-hybrid key exchange.',
|
|
199
|
+
};
|
|
200
|
+
const RULE_JAVA_TLS_NOVERIFY = {
|
|
201
|
+
id: "java-tls-hostname-verification-disabled",
|
|
202
|
+
title: "TLS hostname verification disabled",
|
|
203
|
+
description: "NoopHostnameVerifier / ALLOW_ALL_HOSTNAME_VERIFIER",
|
|
204
|
+
category: "tls",
|
|
205
|
+
severity: "high",
|
|
206
|
+
confidence: "high",
|
|
207
|
+
hndl: false,
|
|
208
|
+
cwe: CWE_CERT_VALIDATION,
|
|
209
|
+
message: "An all-trusting hostname verifier (Java) disables TLS hostname checking (MITM risk).",
|
|
210
|
+
remediation: "Remove the all-trusting verifier; rely on the default hostname verifier.",
|
|
211
|
+
};
|
|
212
|
+
const RULE_JAVA_JWT_ALG = {
|
|
213
|
+
id: "java-jwt-alg",
|
|
214
|
+
title: "Java identifier-form JWT/JOSE algorithm",
|
|
215
|
+
description: "jjwt SignatureAlgorithm.RS/PS/ES* / auth0 Algorithm.RSA*/ECDSA*",
|
|
216
|
+
category: "signature",
|
|
217
|
+
severity: "high",
|
|
218
|
+
confidence: "high",
|
|
219
|
+
algorithm: "unknown",
|
|
220
|
+
hndl: false,
|
|
221
|
+
cwe: CWE_BROKEN_CRYPTO,
|
|
222
|
+
message: "A classical JWT/JOSE signature algorithm (Java, identifier form) is used, forgeable by a quantum attacker.",
|
|
223
|
+
remediation: "ML-DSA-65 (FIPS 204); track IETF PQC JOSE/COSE algorithms",
|
|
224
|
+
};
|
|
127
225
|
/**
|
|
128
226
|
* Classify a `<factory>.getInstance("<alg>")` pair into a rule, or null when the
|
|
129
227
|
* algorithm is not classical asymmetric crypto (AES, HMAC, PBKDF2, hashes, …).
|
|
@@ -143,6 +241,12 @@ function classifyGetInstance(factory, rawAlg) {
|
|
|
143
241
|
return RULE_JAVA_EDDSA;
|
|
144
242
|
if (alg.includes("X25519") || alg.includes("X448") || alg === "XDH")
|
|
145
243
|
return RULE_JAVA_XDH;
|
|
244
|
+
// RSASSA-PSS is an RSA *signature* scheme, not encryption/KEM. The string
|
|
245
|
+
// contains "RSA", so it must be caught here — BEFORE the generic RSA branch
|
|
246
|
+
// below, which would otherwise (mis)classify it as HNDL-exposed RSA
|
|
247
|
+
// encryption (java-rsa / hndl:true). Signatures are hndl:false. (Fixes F8.)
|
|
248
|
+
if (alg.includes("PSS"))
|
|
249
|
+
return RULE_JAVA_RSA_SIGN;
|
|
146
250
|
if (alg.includes("RSA"))
|
|
147
251
|
return isSignature ? RULE_JAVA_RSA_SIGN : RULE_JAVA_RSA;
|
|
148
252
|
if (alg.includes("DSA"))
|
|
@@ -161,6 +265,24 @@ const BC_CLASS_RULES = {
|
|
|
161
265
|
Ed448Signer: RULE_JAVA_EDDSA,
|
|
162
266
|
X25519Agreement: RULE_JAVA_XDH,
|
|
163
267
|
X448Agreement: RULE_JAVA_XDH,
|
|
268
|
+
ECDHBasicAgreement: RULE_JAVA_ECDH,
|
|
269
|
+
DHBasicAgreement: RULE_JAVA_DH,
|
|
270
|
+
X25519KeyPairGenerator: RULE_JAVA_XDH,
|
|
271
|
+
Ed25519KeyPairGenerator: RULE_JAVA_EDDSA,
|
|
272
|
+
RSAEngine: RULE_JAVA_RSA,
|
|
273
|
+
OAEPEncoding: RULE_JAVA_RSA,
|
|
274
|
+
};
|
|
275
|
+
/** BouncyCastle lightweight-API bare-constructor class name → family rule. */
|
|
276
|
+
const BC_CURVE_CLASS_RULES = {
|
|
277
|
+
X448KeyPairGenerator: RULE_JAVA_BC_X448,
|
|
278
|
+
X448Agreement: RULE_JAVA_BC_X448,
|
|
279
|
+
X448PrivateKeyParameters: RULE_JAVA_BC_X448,
|
|
280
|
+
X25519KeyPairGenerator: RULE_JAVA_BC_X25519,
|
|
281
|
+
X25519Agreement: RULE_JAVA_BC_X25519,
|
|
282
|
+
Ed448KeyPairGenerator: RULE_JAVA_BC_EDDSA,
|
|
283
|
+
Ed448Signer: RULE_JAVA_BC_EDDSA,
|
|
284
|
+
Ed25519KeyPairGenerator: RULE_JAVA_BC_EDDSA,
|
|
285
|
+
Ed25519Signer: RULE_JAVA_BC_EDDSA,
|
|
164
286
|
};
|
|
165
287
|
/** Detects classical asymmetric crypto in Java / Kotlin (JCA + BouncyCastle). */
|
|
166
288
|
export const javaDetector = {
|
|
@@ -178,6 +300,12 @@ export const javaDetector = {
|
|
|
178
300
|
RULE_JAVA_DH,
|
|
179
301
|
RULE_JAVA_XDH,
|
|
180
302
|
RULE_JAVA_EDDSA,
|
|
303
|
+
RULE_JAVA_BC_X448,
|
|
304
|
+
RULE_JAVA_BC_X25519,
|
|
305
|
+
RULE_JAVA_BC_EDDSA,
|
|
306
|
+
RULE_JAVA_TLS_LEGACY,
|
|
307
|
+
RULE_JAVA_TLS_NOVERIFY,
|
|
308
|
+
RULE_JAVA_JWT_ALG,
|
|
181
309
|
],
|
|
182
310
|
appliesTo: (f) => hasExtension(f, JAVA_EXTENSIONS),
|
|
183
311
|
detect({ file, content }) {
|
|
@@ -194,6 +322,43 @@ export const javaDetector = {
|
|
|
194
322
|
return;
|
|
195
323
|
findings.push(findingFromRule(rule, { file, content, index: m.index, matchLength: m[0].length }));
|
|
196
324
|
});
|
|
325
|
+
// BouncyCastle lightweight-API classes as a bare constructor call (Kotlin
|
|
326
|
+
// form, no `new`). RE_JAVA_BC_CURVE's negative lookbehind excludes the
|
|
327
|
+
// `new <Class>(` form already handled above, so this only adds the missed
|
|
328
|
+
// 448/25519 Kotlin-style matches — no double-counting.
|
|
329
|
+
eachMatch(RE_JAVA_BC_CURVE, content, (m) => {
|
|
330
|
+
const rule = BC_CURVE_CLASS_RULES[m[1]];
|
|
331
|
+
if (!rule)
|
|
332
|
+
return;
|
|
333
|
+
findings.push(findingFromRule(rule, { file, content, index: m.index, matchLength: m[0].length }));
|
|
334
|
+
});
|
|
335
|
+
// Legacy SSL/TLS protocol version requested from SSLContext.
|
|
336
|
+
eachMatch(RE_JAVA_TLS_LEGACY, content, (m) => {
|
|
337
|
+
findings.push(findingFromRule(RULE_JAVA_TLS_LEGACY, {
|
|
338
|
+
file,
|
|
339
|
+
content,
|
|
340
|
+
index: m.index,
|
|
341
|
+
matchLength: m[0].length,
|
|
342
|
+
}));
|
|
343
|
+
});
|
|
344
|
+
// All-trusting hostname verifier — disables TLS hostname verification.
|
|
345
|
+
eachMatch(RE_JAVA_TLS_NOVERIFY, content, (m) => {
|
|
346
|
+
findings.push(findingFromRule(RULE_JAVA_TLS_NOVERIFY, {
|
|
347
|
+
file,
|
|
348
|
+
content,
|
|
349
|
+
index: m.index,
|
|
350
|
+
matchLength: m[0].length,
|
|
351
|
+
}));
|
|
352
|
+
});
|
|
353
|
+
// Identifier-form JWT/JOSE signature algorithms (jjwt / auth0).
|
|
354
|
+
eachMatch(RE_JAVA_JWT_ALG, content, (m) => {
|
|
355
|
+
findings.push(findingFromRule(RULE_JAVA_JWT_ALG, {
|
|
356
|
+
file,
|
|
357
|
+
content,
|
|
358
|
+
index: m.index,
|
|
359
|
+
matchLength: m[0].length,
|
|
360
|
+
}));
|
|
361
|
+
});
|
|
197
362
|
return findings;
|
|
198
363
|
},
|
|
199
364
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"java.js","sourceRoot":"","sources":["../../src/detectors/java.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,8EAA8E;AAC9E,8EAA8E;AAC9E,iCAAiC;AACjC,MAAM,mBAAmB,GACvB,oGAAoG,CAAC;AAEvG,qDAAqD;AACrD,MAAM,UAAU,GACd,gJAAgJ,CAAC;AAEnJ,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,MAAM,aAAa,GAAa;IAC9B,EAAE,EAAE,UAAU;IACd,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,gDAAgD;IAC7D,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,iBAAiB;IACtB,OAAO,EAAE,kFAAkF;CAC5F,CAAC;AACF,MAAM,kBAAkB,GAAa;IACnC,EAAE,EAAE,eAAe;IACnB,KAAK,EAAE,oBAAoB;IAC3B,WA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IAAI,CACX,eAAe,CAAC,sBAAsB,EAAE;gBACtC,IAAI;gBACJ,OAAO;gBACP,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM;aACzB,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,gEAAgE;QAChE,SAAS,CAAC,eAAe,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACxC,QAAQ,CAAC,IAAI,CACX,eAAe,CAAC,iBAAiB,EAAE;gBACjC,IAAI;gBACJ,OAAO;gBACP,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM;aACzB,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC","sourcesContent":["/**\n * Source-code detector for classical, non-quantum-safe asymmetric cryptography\n * in Java / Kotlin (the JCA — Java Cryptography Architecture). Same lexical\n * strategy as the other language packs.\n *\n * The JCA funnels almost everything through a handful of factory methods keyed\n * by an ALGORITHM STRING: `KeyPairGenerator.getInstance(\"RSA\")`,\n * `Signature.getInstance(\"SHA256withECDSA\")`, `Cipher.getInstance(\"RSA/ECB/…\")`,\n * `KeyAgreement.getInstance(\"ECDH\")`. So detection here is two steps: match the\n * `<Factory>.getInstance(\"<alg>\")` call, then classify the (factory, alg) pair\n * into a rule. Symmetric / hashing algorithms (\"AES\", \"HmacSHA256\", …) classify\n * to nothing and are ignored. A small set of BouncyCastle lightweight-API class\n * names (`new ECDSASigner()`, `new X25519Agreement()`, …) is matched directly.\n *\n * HNDL policy mirrors the other detectors: KEM / key agreement (RSA encryption,\n * (EC)DH, X25519/X448) is harvest-now-decrypt-later exposed (hndl:true);\n * signatures (RSA/ECDSA/DSA/EdDSA) are hndl:false but forgeable by a quantum\n * attacker. `KeyPairGenerator.getInstance(\"EC\")` is ambiguous (an EC key feeds\n * both ECDSA and ECDH), so it is classified conservatively as\n * key-exchange-capable (hndl:true), exactly as the Node/Python EC keygen rules.\n */\nimport type { Detector, Finding, RuleMeta } from \"../types.js\";\nimport { JAVA_EXTENSIONS, eachMatch, findingFromRule, hasExtension } from \"../detect-utils.js\";\nimport { CWE_BROKEN_CRYPTO, CWE_CERT_VALIDATION, CWE_WEAK_STRENGTH } from \"../cwe.js\";\n\n/* -------------------------------------------------------------------------- */\n/* Regexes */\n/* -------------------------------------------------------------------------- */\n\n// <Factory>.getInstance(\"<alg>\") — the JCA entry points that carry asymmetric\n// algorithms. KeyGenerator/MessageDigest/Mac are intentionally excluded (they\n// are symmetric / hashing only).\nconst RE_JAVA_GETINSTANCE =\n /\\b(KeyPairGenerator|Signature|Cipher|KeyAgreement|KeyFactory)\\s*\\.\\s*getInstance\\s*\\(\\s*\"([^\"]+)\"/g;\n\n// BouncyCastle lightweight-API class instantiations.\nconst RE_JAVA_BC =\n /\\bnew\\s+(RSAKeyPairGenerator|DSAKeyPairGenerator|ECKeyPairGenerator|ECDSASigner|Ed25519Signer|Ed448Signer|X25519Agreement|X448Agreement|ECDHBasicAgreement|DHBasicAgreement|X25519KeyPairGenerator|Ed25519KeyPairGenerator|RSAEngine|OAEPEncoding)\\s*\\(/g;\n\n// BouncyCastle lightweight-API curve/EdDSA classes as a BARE constructor call —\n// the Kotlin form (`X448KeyPairGenerator()`, no `new` keyword). RE_JAVA_BC above\n// only matches the Java `new <Class>(` form, so Kotlin sources that drive the\n// lightweight API directly are missed. The negative lookbehind `(?<!\\bnew\\s+)`\n// keeps this additive: `new X448Agreement(` stays with RE_JAVA_BC (java-xdh),\n// while bare `X448Agreement(` routes to the family-specific rules below. Scoped\n// to the exact X448/X25519/Ed448/Ed25519 class names to stay precise.\nconst RE_JAVA_BC_CURVE =\n /(?<!\\bnew\\s+)\\b(X448KeyPairGenerator|X448Agreement|X448PrivateKeyParameters|X25519KeyPairGenerator|X25519Agreement|Ed448KeyPairGenerator|Ed448Signer|Ed25519KeyPairGenerator|Ed25519Signer)\\s*\\(/g;\n\n// Insecure JSSE / TLS configuration expressed in Java source. Mirrors the JS\n// tlsDetector in source.ts (category \"tls\"): a legacy SSL/TLS protocol version\n// requested from SSLContext, and TLS hostname verification neutered via an\n// all-trusting verifier (Apache HttpClient's NoopHostnameVerifier /\n// ALLOW_ALL_HOSTNAME_VERIFIER).\nconst RE_JAVA_TLS_LEGACY = /\\bSSLContext\\s*\\.\\s*getInstance\\s*\\(\\s*\"(SSL|SSLv3|TLSv1)\"/g;\nconst RE_JAVA_TLS_NOVERIFY = /\\b(NoopHostnameVerifier|ALLOW_ALL_HOSTNAME_VERIFIER)\\b/g;\n\n// Identifier-form JWT/JOSE signature algorithms (audit F7). The quoted-string\n// alg token (\"RS256\") is caught by the language-agnostic jwt-jose detector, but\n// the Java JWT libraries pass the alg as an IDENTIFIER, not a string literal:\n// jjwt's `SignatureAlgorithm.RS256` and auth0 java-jwt's `Algorithm.RSA256` /\n// `Algorithm.ECDSA256`. (\"SignatureAlgorithm\" has no word boundary before its\n// \"Algorithm\", so the auth0 branch cannot re-match the jjwt form.)\nconst RE_JAVA_JWT_ALG =\n /\\bSignatureAlgorithm\\.(?:RS|PS|ES)(?:256|384|512)\\b|\\bAlgorithm\\.(?:RSA|ECDSA)(?:256|384|512)\\b/g;\n\n/* -------------------------------------------------------------------------- */\n/* Rule catalog */\n/* -------------------------------------------------------------------------- */\n\nconst RULE_JAVA_RSA: RuleMeta = {\n id: \"java-rsa\",\n title: \"Java RSA key/encryption\",\n description: \"JCA RSA KeyPairGenerator / Cipher / KeyFactory\",\n category: \"kem\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Classical RSA (Java/JCA) is not quantum-safe and RSA encryption is HNDL-exposed.\",\n};\nconst RULE_JAVA_RSA_SIGN: RuleMeta = {\n id: \"java-rsa-sign\",\n title: \"Java RSA signature\",\n description: 'JCA Signature.getInstance(\"…withRSA\")',\n category: \"signature\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"RSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Classical RSA signing (Java/JCA) is forgeable by a quantum attacker.\",\n remediation: \"ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205)\",\n};\nconst RULE_JAVA_EC_KEYGEN: RuleMeta = {\n id: \"java-ec-keygen\",\n title: \"Java EC key generation\",\n description: 'JCA KeyPairGenerator.getInstance(\"EC\")',\n category: \"key-exchange\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"ECDH\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Generates a classical EC key pair (Java/JCA). EC keys feed BOTH ECDSA signatures and ECDH key agreement; the ECDH path is harvest-now-decrypt-later exposed.\",\n remediation:\n \"For key agreement: hybrid X25519MLKEM768 (ML-KEM-768). For signatures: ML-DSA-65 (FIPS 204).\",\n};\nconst RULE_JAVA_ECDSA_SIGN: RuleMeta = {\n id: \"java-ecdsa-sign\",\n title: \"Java ECDSA signature\",\n description: 'JCA Signature.getInstance(\"…withECDSA\")',\n category: \"signature\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"ECDSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Classical ECDSA signing (Java/JCA) is forgeable by a quantum attacker.\",\n remediation: \"ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205)\",\n};\nconst RULE_JAVA_ECDH: RuleMeta = {\n id: \"java-ecdh\",\n title: \"Java ECDH key agreement\",\n description: 'JCA KeyAgreement.getInstance(\"ECDH\")',\n category: \"key-exchange\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"ECDH\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Elliptic-curve Diffie-Hellman (Java/JCA) is broken by Shor's algorithm (harvest-now-decrypt-later).\",\n};\nconst RULE_JAVA_DSA: RuleMeta = {\n id: \"java-dsa\",\n title: \"Java DSA key/signature\",\n description: \"JCA DSA KeyPairGenerator / Signature\",\n category: \"signature\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"DSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Classical DSA (Java/JCA) is deprecated and forgeable by a quantum attacker.\",\n remediation: \"Rotate off DSA and migrate to ML-DSA-65 (FIPS 204).\",\n};\nconst RULE_JAVA_DH: RuleMeta = {\n id: \"java-dh\",\n title: \"Java Diffie-Hellman key exchange\",\n description: \"JCA DiffieHellman KeyPairGenerator / KeyAgreement\",\n category: \"key-exchange\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"DH\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Finite-field Diffie-Hellman (Java/JCA) is broken by Shor's algorithm (harvest-now-decrypt-later).\",\n};\nconst RULE_JAVA_XDH: RuleMeta = {\n id: \"java-xdh\",\n title: \"Java X25519/X448 key agreement\",\n description: \"JCA XDH / X25519 / X448 (KeyPairGenerator / KeyAgreement)\",\n category: \"key-exchange\",\n severity: \"medium\",\n confidence: \"high\",\n algorithm: \"X25519\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"X25519/X448 (Java/JCA) is modern but still classical key agreement — harvest-now-decrypt-later.\",\n};\nconst RULE_JAVA_EDDSA: RuleMeta = {\n id: \"java-eddsa\",\n title: \"Java Ed25519/Ed448 signature\",\n description: \"JCA EdDSA / Ed25519 / Ed448\",\n category: \"signature\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"EdDSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message: \"Ed25519/Ed448 (Java/JCA) is a modern but still classical signature scheme.\",\n};\n// BouncyCastle lightweight-API rules for bare (Kotlin-form) constructor calls.\n// Split by family so X448 and X25519 report their own algorithm string (java-xdh\n// lumps both under \"X25519\"). Severity/CWE copied from the JCA siblings above.\nconst RULE_JAVA_BC_X448: RuleMeta = {\n id: \"java-bc-x448\",\n title: \"Java/Kotlin X448 key agreement (BouncyCastle lightweight API)\",\n description: \"BouncyCastle X448KeyPairGenerator / X448Agreement / X448PrivateKeyParameters\",\n category: \"key-exchange\",\n severity: \"medium\",\n confidence: \"high\",\n algorithm: \"X448\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"X448 (Java/Kotlin, BouncyCastle lightweight API) is modern but still classical key agreement — harvest-now-decrypt-later.\",\n};\nconst RULE_JAVA_BC_X25519: RuleMeta = {\n id: \"java-bc-x25519\",\n title: \"Java/Kotlin X25519 key agreement (BouncyCastle lightweight API)\",\n description: \"BouncyCastle X25519KeyPairGenerator / X25519Agreement\",\n category: \"key-exchange\",\n severity: \"medium\",\n confidence: \"high\",\n algorithm: \"X25519\",\n hndl: true,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"X25519 (Java/Kotlin, BouncyCastle lightweight API) is modern but still classical key agreement — harvest-now-decrypt-later.\",\n};\nconst RULE_JAVA_BC_EDDSA: RuleMeta = {\n id: \"java-bc-eddsa\",\n title: \"Java/Kotlin Ed25519/Ed448 signature (BouncyCastle lightweight API)\",\n description:\n \"BouncyCastle Ed448KeyPairGenerator / Ed448Signer / Ed25519KeyPairGenerator / Ed25519Signer\",\n category: \"signature\",\n severity: \"low\",\n confidence: \"high\",\n algorithm: \"EdDSA\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"Ed25519/Ed448 (Java/Kotlin, BouncyCastle lightweight API) is a modern but still classical signature scheme.\",\n};\nconst RULE_JAVA_TLS_LEGACY: RuleMeta = {\n id: \"java-tls-legacy-version\",\n title: \"Legacy SSL/TLS version requested\",\n description: 'SSLContext.getInstance(\"SSL\" | \"SSLv3\" | \"TLSv1\")',\n category: \"tls\",\n severity: \"medium\",\n confidence: \"high\",\n hndl: false,\n cwe: CWE_WEAK_STRENGTH,\n message: \"SSL/SSLv3/TLS 1.0 are deprecated and insecure (Java/JSSE); require TLS 1.3.\",\n remediation: 'Use SSLContext.getInstance(\"TLSv1.3\") and prefer PQC-hybrid key exchange.',\n};\nconst RULE_JAVA_TLS_NOVERIFY: RuleMeta = {\n id: \"java-tls-hostname-verification-disabled\",\n title: \"TLS hostname verification disabled\",\n description: \"NoopHostnameVerifier / ALLOW_ALL_HOSTNAME_VERIFIER\",\n category: \"tls\",\n severity: \"high\",\n confidence: \"high\",\n hndl: false,\n cwe: CWE_CERT_VALIDATION,\n message: \"An all-trusting hostname verifier (Java) disables TLS hostname checking (MITM risk).\",\n remediation: \"Remove the all-trusting verifier; rely on the default hostname verifier.\",\n};\nconst RULE_JAVA_JWT_ALG: RuleMeta = {\n id: \"java-jwt-alg\",\n title: \"Java identifier-form JWT/JOSE algorithm\",\n description: \"jjwt SignatureAlgorithm.RS/PS/ES* / auth0 Algorithm.RSA*/ECDSA*\",\n category: \"signature\",\n severity: \"high\",\n confidence: \"high\",\n algorithm: \"unknown\",\n hndl: false,\n cwe: CWE_BROKEN_CRYPTO,\n message:\n \"A classical JWT/JOSE signature algorithm (Java, identifier form) is used, forgeable by a quantum attacker.\",\n remediation: \"ML-DSA-65 (FIPS 204); track IETF PQC JOSE/COSE algorithms\",\n};\n\n/**\n * Classify a `<factory>.getInstance(\"<alg>\")` pair into a rule, or null when the\n * algorithm is not classical asymmetric crypto (AES, HMAC, PBKDF2, hashes, …).\n * `alg` is normalised to upper-case with any Cipher transformation suffix\n * (`RSA/ECB/OAEPPadding` → `RSA`) stripped.\n */\nfunction classifyGetInstance(factory: string, rawAlg: string): RuleMeta | null {\n const alg = rawAlg.split(\"/\")[0].trim().toUpperCase();\n const isSignature = factory === \"Signature\";\n\n if (alg.includes(\"ECDSA\")) return RULE_JAVA_ECDSA_SIGN;\n if (alg.includes(\"ECDH\")) return RULE_JAVA_ECDH;\n if (alg === \"EC\") return isSignature ? RULE_JAVA_ECDSA_SIGN : RULE_JAVA_EC_KEYGEN;\n if (alg.includes(\"ED25519\") || alg.includes(\"ED448\") || alg.includes(\"EDDSA\"))\n return RULE_JAVA_EDDSA;\n if (alg.includes(\"X25519\") || alg.includes(\"X448\") || alg === \"XDH\") return RULE_JAVA_XDH;\n // RSASSA-PSS is an RSA *signature* scheme, not encryption/KEM. The string\n // contains \"RSA\", so it must be caught here — BEFORE the generic RSA branch\n // below, which would otherwise (mis)classify it as HNDL-exposed RSA\n // encryption (java-rsa / hndl:true). Signatures are hndl:false. (Fixes F8.)\n if (alg.includes(\"PSS\")) return RULE_JAVA_RSA_SIGN;\n if (alg.includes(\"RSA\")) return isSignature ? RULE_JAVA_RSA_SIGN : RULE_JAVA_RSA;\n if (alg.includes(\"DSA\")) return RULE_JAVA_DSA; // ECDSA already handled above\n if (alg.includes(\"DH\") || alg.includes(\"DIFFIEHELLMAN\")) return RULE_JAVA_DH;\n return null;\n}\n\n/** BouncyCastle lightweight-API class name → rule. */\nconst BC_CLASS_RULES: Record<string, RuleMeta> = {\n RSAKeyPairGenerator: RULE_JAVA_RSA,\n DSAKeyPairGenerator: RULE_JAVA_DSA,\n ECKeyPairGenerator: RULE_JAVA_EC_KEYGEN,\n ECDSASigner: RULE_JAVA_ECDSA_SIGN,\n Ed25519Signer: RULE_JAVA_EDDSA,\n Ed448Signer: RULE_JAVA_EDDSA,\n X25519Agreement: RULE_JAVA_XDH,\n X448Agreement: RULE_JAVA_XDH,\n ECDHBasicAgreement: RULE_JAVA_ECDH,\n DHBasicAgreement: RULE_JAVA_DH,\n X25519KeyPairGenerator: RULE_JAVA_XDH,\n Ed25519KeyPairGenerator: RULE_JAVA_EDDSA,\n RSAEngine: RULE_JAVA_RSA,\n OAEPEncoding: RULE_JAVA_RSA,\n};\n\n/** BouncyCastle lightweight-API bare-constructor class name → family rule. */\nconst BC_CURVE_CLASS_RULES: Record<string, RuleMeta> = {\n X448KeyPairGenerator: RULE_JAVA_BC_X448,\n X448Agreement: RULE_JAVA_BC_X448,\n X448PrivateKeyParameters: RULE_JAVA_BC_X448,\n X25519KeyPairGenerator: RULE_JAVA_BC_X25519,\n X25519Agreement: RULE_JAVA_BC_X25519,\n Ed448KeyPairGenerator: RULE_JAVA_BC_EDDSA,\n Ed448Signer: RULE_JAVA_BC_EDDSA,\n Ed25519KeyPairGenerator: RULE_JAVA_BC_EDDSA,\n Ed25519Signer: RULE_JAVA_BC_EDDSA,\n};\n\n/** Detects classical asymmetric crypto in Java / Kotlin (JCA + BouncyCastle). */\nexport const javaDetector: Detector = {\n id: \"java-crypto\",\n description: \"Classical asymmetric crypto in Java/Kotlin (JCA getInstance + BouncyCastle)\",\n scope: \"source\",\n language: \"java\",\n rules: [\n RULE_JAVA_RSA,\n RULE_JAVA_RSA_SIGN,\n RULE_JAVA_EC_KEYGEN,\n RULE_JAVA_ECDSA_SIGN,\n RULE_JAVA_ECDH,\n RULE_JAVA_DSA,\n RULE_JAVA_DH,\n RULE_JAVA_XDH,\n RULE_JAVA_EDDSA,\n RULE_JAVA_BC_X448,\n RULE_JAVA_BC_X25519,\n RULE_JAVA_BC_EDDSA,\n RULE_JAVA_TLS_LEGACY,\n RULE_JAVA_TLS_NOVERIFY,\n RULE_JAVA_JWT_ALG,\n ],\n appliesTo: (f) => hasExtension(f, JAVA_EXTENSIONS),\n detect({ file, content }): Finding[] {\n const findings: Finding[] = [];\n\n eachMatch(RE_JAVA_GETINSTANCE, content, (m) => {\n const rule = classifyGetInstance(m[1], m[2]);\n if (!rule) return; // symmetric / hashing algorithm — not our concern.\n findings.push(\n findingFromRule(rule, { file, content, index: m.index, matchLength: m[0].length }),\n );\n });\n\n eachMatch(RE_JAVA_BC, content, (m) => {\n const rule = BC_CLASS_RULES[m[1]];\n if (!rule) return;\n findings.push(\n findingFromRule(rule, { file, content, index: m.index, matchLength: m[0].length }),\n );\n });\n\n // BouncyCastle lightweight-API classes as a bare constructor call (Kotlin\n // form, no `new`). RE_JAVA_BC_CURVE's negative lookbehind excludes the\n // `new <Class>(` form already handled above, so this only adds the missed\n // 448/25519 Kotlin-style matches — no double-counting.\n eachMatch(RE_JAVA_BC_CURVE, content, (m) => {\n const rule = BC_CURVE_CLASS_RULES[m[1]];\n if (!rule) return;\n findings.push(\n findingFromRule(rule, { file, content, index: m.index, matchLength: m[0].length }),\n );\n });\n\n // Legacy SSL/TLS protocol version requested from SSLContext.\n eachMatch(RE_JAVA_TLS_LEGACY, content, (m) => {\n findings.push(\n findingFromRule(RULE_JAVA_TLS_LEGACY, {\n file,\n content,\n index: m.index,\n matchLength: m[0].length,\n }),\n );\n });\n\n // All-trusting hostname verifier — disables TLS hostname verification.\n eachMatch(RE_JAVA_TLS_NOVERIFY, content, (m) => {\n findings.push(\n findingFromRule(RULE_JAVA_TLS_NOVERIFY, {\n file,\n content,\n index: m.index,\n matchLength: m[0].length,\n }),\n );\n });\n\n // Identifier-form JWT/JOSE signature algorithms (jjwt / auth0).\n eachMatch(RE_JAVA_JWT_ALG, content, (m) => {\n findings.push(\n findingFromRule(RULE_JAVA_JWT_ALG, {\n file,\n content,\n index: m.index,\n matchLength: m[0].length,\n }),\n );\n });\n\n return findings;\n },\n};\n"]}
|