@profullstack/threatcrush 0.8.0 → 0.9.0
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/daemon.js +50 -0
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9998,6 +9998,56 @@ var CODE_RULES = [
|
|
|
9998
9998
|
severity: "high",
|
|
9999
9999
|
pattern: /(?:token|secret|password|salt|nonce|session|otp|reset|apikey|api_key)[\w]*\s*[:=][^;\n]{0,60}(?:Math\s*\.\s*random\s*\(|\brandom\s*\.\s*(?:random|randint|choice)\s*\(|\brand\s*\()/i
|
|
10000
10000
|
},
|
|
10001
|
+
// ── Weak crypto: Python ──────────────────────────────────────────────────
|
|
10002
|
+
//
|
|
10003
|
+
// The generic rules above catch the credential case on the matched line.
|
|
10004
|
+
// These cover what they miss in Python, where the security role of a value is
|
|
10005
|
+
// set by the enclosing function rather than a same-line assignment — a
|
|
10006
|
+
// `random`-drawn token that is *returned*, an MD5 used to *verify* an
|
|
10007
|
+
// artifact — and the broken ciphers, which have no safe use at all.
|
|
10008
|
+
{
|
|
10009
|
+
id: "py-broken-cipher",
|
|
10010
|
+
title: "broken cipher or ECB mode",
|
|
10011
|
+
consequence: "DES, RC2, RC4 and Blowfish are broken or too small to rely on, and ECB encrypts identical plaintext blocks to identical ciphertext, so structure in the data survives encryption. None of them provides the confidentiality their use implies.",
|
|
10012
|
+
cwe: "CWE-327",
|
|
10013
|
+
severity: "high",
|
|
10014
|
+
languages: ["python"],
|
|
10015
|
+
// PyCryptodome/PyCrypto constructors. The mode matters only for AES, whose
|
|
10016
|
+
// safe modes (GCM, CTR, CBC) are common — so AES matches solely on ECB,
|
|
10017
|
+
// while DES/RC4/Blowfish are broken by the algorithm regardless of mode.
|
|
10018
|
+
pattern: /\b(?:DES|DES3|ARC2|RC2|ARC4|RC4|Blowfish|XOR)\s*\.\s*new\s*\(|\bAES\s*\.\s*new\s*\([^)\n]*\bMODE_ECB\b/,
|
|
10019
|
+
inherent: true,
|
|
10020
|
+
guard: false
|
|
10021
|
+
},
|
|
10022
|
+
{
|
|
10023
|
+
id: "py-weak-hash",
|
|
10024
|
+
title: "broken hash algorithm",
|
|
10025
|
+
consequence: "MD5 and SHA-1 have practical collisions, so a digest used for integrity or a signature can be forged to match a value the code trusts.",
|
|
10026
|
+
cwe: "CWE-327",
|
|
10027
|
+
severity: "medium",
|
|
10028
|
+
languages: ["python"],
|
|
10029
|
+
pattern: /\bhashlib\s*\.\s*(?:md5|sha1)\s*\(/,
|
|
10030
|
+
// Python 3.9+ marks a non-security digest — a cache key, an ETag — with
|
|
10031
|
+
// `usedforsecurity=False`, which is exactly the "this MD5 is not a security
|
|
10032
|
+
// claim" signal, so it exempts the line rather than being flagged.
|
|
10033
|
+
lineGuard: /usedforsecurity\s*=\s*False/
|
|
10034
|
+
},
|
|
10035
|
+
{
|
|
10036
|
+
id: "py-predictable-random-seed",
|
|
10037
|
+
title: "PRNG seeded from a predictable value",
|
|
10038
|
+
consequence: "Seeding `random` from the clock or the process id makes its whole sequence reproducible, so anything drawn from it afterwards \u2014 a token, an id, a shuffle \u2014 can be regenerated by guessing the seed.",
|
|
10039
|
+
cwe: "CWE-338",
|
|
10040
|
+
severity: "high",
|
|
10041
|
+
languages: ["python"],
|
|
10042
|
+
// A time- or pid-derived seed, which is the predictable kind. A fixed
|
|
10043
|
+
// integer seed (`random.seed(42)`) is deliberate reproducibility for tests
|
|
10044
|
+
// and simulations, so it is left alone. This needs no credential context:
|
|
10045
|
+
// seeding the global PRNG from the clock is a weakness on its own terms,
|
|
10046
|
+
// which is why the enclosing function's name — that this engine does not
|
|
10047
|
+
// read as evidence anyway — is not consulted.
|
|
10048
|
+
pattern: /\brandom\s*\.\s*seed\s*\([^)\n]*(?:time\s*\.\s*time|datetime|\.\s*now\s*\(|getpid)/,
|
|
10049
|
+
inherent: true
|
|
10050
|
+
},
|
|
10001
10051
|
{
|
|
10002
10052
|
id: "redos-nested-quantifier",
|
|
10003
10053
|
title: "regex with nested unbounded quantifiers",
|