@profullstack/threatcrush 0.12.5 → 0.12.7
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 +21 -6
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +73 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/daemon.js
CHANGED
|
@@ -5063,6 +5063,7 @@ var GENERIC_GUARD = (
|
|
|
5063
5063
|
);
|
|
5064
5064
|
var XXE_GUARD = /FEATURE_SECURE_PROCESSING|setExpandEntityReferences|disallow-doctype-decl|external-general-entities|external-parameter-entities|setXIncludeAware\s*\(\s*false/;
|
|
5065
5065
|
var XML_PARSING_FILE = /\b(?:javax\.xml|org\.xml\.sax|org\.w3c\.dom|org\.jdom2?|org\.dom4j|XmlPullParser|DocumentBuilderFactory|DocumentBuilder|SAXParserFactory|SAXParser|XMLInputFactory|XMLReaderFactory|XMLReader|SAXBuilder|SAXReader)\b/;
|
|
5066
|
+
var PY_XPATH_FILE = /\b(?:lxml|xml\.etree|ElementTree|etree|defusedxml|xpath)\b/i;
|
|
5066
5067
|
var CODE_SINK = /\bglobalThis\s*\[|\bconstructor\b|\beval\b|\bFunction\b|\brun\s*\(|\bvm\s*\.\s*run/;
|
|
5067
5068
|
var EXFIL_SINK = /\bconsole\s*\.\s*(?:log|debug|info|warn|error)\s*\(|\bfetch\s*\(|\baxios\b|\brequest\s*\(|\.\s*send\s*\(/;
|
|
5068
5069
|
var SQL_KEYWORDS = "SELECT\\b(?=[^`'\"\\n]*\\bFROM\\b)|INSERT\\s+INTO|UPDATE\\b(?=[^`'\"\\n]*\\bSET\\b)|DELETE\\s+FROM|DROP\\s+(?:TABLE|DATABASE|INDEX|VIEW|SCHEMA)|TRUNCATE\\s+TABLE|UNION\\s+SELECT";
|
|
@@ -6023,8 +6024,11 @@ var CODE_RULES = [
|
|
|
6023
6024
|
severity: "high",
|
|
6024
6025
|
languages: ["python"],
|
|
6025
6026
|
// Per-quote, so an inner `'` in a `"`-delimited f-string (`text()='{x}'`)
|
|
6026
|
-
// does not truncate the match before the interpolation.
|
|
6027
|
-
|
|
6027
|
+
// does not truncate the match before the interpolation. `(?<!:)` keeps the
|
|
6028
|
+
// `//` of a URL scheme out of it: `f"https://{host}/v1"` is a URL, not a
|
|
6029
|
+
// descendant-or-self step, and it was by far the commonest match here.
|
|
6030
|
+
pattern: /\bf"[^"\n]*(?:(?<!:)\/\/|\/\w+\[)[^"\n]*\{[^}\n]+\}|\bf'[^'\n]*(?:(?<!:)\/\/|\/\w+\[)[^'\n]*\{[^}\n]+\}/,
|
|
6031
|
+
fileRequires: PY_XPATH_FILE
|
|
6028
6032
|
},
|
|
6029
6033
|
{
|
|
6030
6034
|
id: "py-fast-password-hash",
|
|
@@ -7004,7 +7008,7 @@ var SECRET_RULES = [
|
|
|
7004
7008
|
keywordShaped: true
|
|
7005
7009
|
}
|
|
7006
7010
|
];
|
|
7007
|
-
var INTERPOLATION = String.raw`(?:\{\{[^}]*\}\}|\$\{[^}]*\}|\$[A-Za-z_]\w*|%[sdv])`;
|
|
7011
|
+
var INTERPOLATION = String.raw`(?:\{\{[^}]*\}\}|\$\{[^}]*\}|\$[A-Za-z_]\w*|%[sdv]|\{[^{}\s'"@/]+\}|<[A-Za-z_][\w.-]*>)`;
|
|
7008
7012
|
var KNOWN_PLACEHOLDERS = [
|
|
7009
7013
|
// Deliberately NOT here: AWS's published documentation key/secret pair
|
|
7010
7014
|
// (`AKIAIOSFODNN7EXAMPLE`, `wJalrXUtnFEMI/…`). GitHub allow-lists them, and
|
|
@@ -9482,14 +9486,25 @@ var RemediationManager = class {
|
|
|
9482
9486
|
}
|
|
9483
9487
|
this.blocklist = live;
|
|
9484
9488
|
this.saveState();
|
|
9485
|
-
|
|
9486
|
-
let applied = [];
|
|
9489
|
+
let applied = null;
|
|
9487
9490
|
try {
|
|
9488
9491
|
applied = await this.adapter.listBlocked();
|
|
9489
9492
|
} catch {
|
|
9490
9493
|
}
|
|
9494
|
+
if (applied) {
|
|
9495
|
+
const known = new Set(live.filter((b) => !b.dry_run).map((b) => b.ip));
|
|
9496
|
+
for (const ip of applied) {
|
|
9497
|
+
if (known.has(ip)) continue;
|
|
9498
|
+
this.logLine(`[firewall] reconcile: dropping stale rule for ${ip} (no record of why)`);
|
|
9499
|
+
try {
|
|
9500
|
+
await this.adapter.unblock(ip);
|
|
9501
|
+
} catch {
|
|
9502
|
+
}
|
|
9503
|
+
}
|
|
9504
|
+
}
|
|
9505
|
+
if (this.config.dry_run) return;
|
|
9491
9506
|
for (const entry of live) {
|
|
9492
|
-
if (applied
|
|
9507
|
+
if (applied?.includes(entry.ip)) continue;
|
|
9493
9508
|
try {
|
|
9494
9509
|
await this.adapter.block(entry.ip);
|
|
9495
9510
|
} catch {
|