secret-blast-radius 0.4.0 → 0.4.1
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/README.md +1 -1
- package/package.json +1 -1
- package/src/util.js +5 -1
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ permissions:
|
|
|
140
140
|
security-events: write
|
|
141
141
|
steps:
|
|
142
142
|
- uses: actions/checkout@v4
|
|
143
|
-
- uses: Krrishkumar125/secret-blast-radius@v0.4.
|
|
143
|
+
- uses: Krrishkumar125/secret-blast-radius@v0.4.1
|
|
144
144
|
with:
|
|
145
145
|
fail-on: critical
|
|
146
146
|
- uses: github/codeql-action/upload-sarif@v3
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "secret-blast-radius",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "What would a malicious npm install steal from this machine or CI runner? Ranked inventory of reachable credentials, known-worm IOCs (Shai-Hulud, @subql, GhostAction), PHP2Shell and PaaS exposure checks, ordered rotation runbook, SARIF. Read-only, offline, never prints secrets.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Krrish Kumar (https://github.com/Krrishkumar125)",
|
package/src/util.js
CHANGED
|
@@ -77,6 +77,7 @@ export function looksLikeSecretName(name) {
|
|
|
77
77
|
return SECRET_NAME.test(name) && !NOT_SECRET_NAME.test(name);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
const EXAMPLE_WORD = /^(secret|secrets|password|passwd|pass|token|key|apikey|api|jwt|session|cookie|signing|local|localhost|dev|development|test|testing|tests|example|examples|sample|demo|dummy|fake|mock|placeholder|change|changeme|replace|me|xxx|todo|redacted|default|insecure|value|your|here|this|not|real|keyboard|cat|foo|bar|baz|my|super|unsafe|temp|tmp|ci)$/i;
|
|
80
81
|
const URL_NAME = /(_url|_uri|_dsn)$|^(dsn)$/i;
|
|
81
82
|
|
|
82
83
|
/** Does this name/value pair hold a literal secret? URL-style names only count when they embed credentials. */
|
|
@@ -87,8 +88,11 @@ export function isSecretPair(name, value) {
|
|
|
87
88
|
if (/^[a-z][a-z0-9+.-]*:\/\/[^/\s@]+@(localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\]|host\.docker\.internal)([:/?]|$)/i.test(v)) return false;
|
|
88
89
|
if (tokenKind(v)) return true;
|
|
89
90
|
// Prose like "local-secret" or "this-is-a-secret-value-..." is a committed example, not a credential.
|
|
91
|
+
// Word shape alone is not enough: "correct-horse-battery-staple" is a real passphrase. Only discard
|
|
92
|
+
// all-word values that also contain a placeholder/example word.
|
|
90
93
|
const words = v.replace(/[!.]+$/, '').split(/[-_ .]+/);
|
|
91
|
-
if (words.length >= 2 && words.every((w) => /^[a-z]+$|^[A-Z]+$|^\d+$/.test(w)) && words.some((w) => /^[a-z]{3,}$/i.test(w))
|
|
94
|
+
if (words.length >= 2 && words.every((w) => /^[a-z]+$|^[A-Z]+$|^\d+$/.test(w)) && words.some((w) => /^[a-z]{3,}$/i.test(w))
|
|
95
|
+
&& words.some((w) => EXAMPLE_WORD.test(w))) return false;
|
|
92
96
|
if (URL_NAME.test(name)) return /^[a-z][a-z0-9+.-]*:\/\/[^/\s:@]+:[^@\s]+@/i.test(v) || /[?&](password|token|key|secret)=[^&\s]+/i.test(v);
|
|
93
97
|
return looksLikeSecretName(name) && v.length >= 8;
|
|
94
98
|
}
|