@profullstack/threatcrush 0.12.6 → 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 +7 -3
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +31 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17736,6 +17736,7 @@ var GENERIC_GUARD = (
|
|
|
17736
17736
|
);
|
|
17737
17737
|
var XXE_GUARD = /FEATURE_SECURE_PROCESSING|setExpandEntityReferences|disallow-doctype-decl|external-general-entities|external-parameter-entities|setXIncludeAware\s*\(\s*false/;
|
|
17738
17738
|
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/;
|
|
17739
|
+
var PY_XPATH_FILE = /\b(?:lxml|xml\.etree|ElementTree|etree|defusedxml|xpath)\b/i;
|
|
17739
17740
|
var CODE_SINK = /\bglobalThis\s*\[|\bconstructor\b|\beval\b|\bFunction\b|\brun\s*\(|\bvm\s*\.\s*run/;
|
|
17740
17741
|
var EXFIL_SINK = /\bconsole\s*\.\s*(?:log|debug|info|warn|error)\s*\(|\bfetch\s*\(|\baxios\b|\brequest\s*\(|\.\s*send\s*\(/;
|
|
17741
17742
|
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";
|
|
@@ -18696,8 +18697,11 @@ var CODE_RULES = [
|
|
|
18696
18697
|
severity: "high",
|
|
18697
18698
|
languages: ["python"],
|
|
18698
18699
|
// Per-quote, so an inner `'` in a `"`-delimited f-string (`text()='{x}'`)
|
|
18699
|
-
// does not truncate the match before the interpolation.
|
|
18700
|
-
|
|
18700
|
+
// does not truncate the match before the interpolation. `(?<!:)` keeps the
|
|
18701
|
+
// `//` of a URL scheme out of it: `f"https://{host}/v1"` is a URL, not a
|
|
18702
|
+
// descendant-or-self step, and it was by far the commonest match here.
|
|
18703
|
+
pattern: /\bf"[^"\n]*(?:(?<!:)\/\/|\/\w+\[)[^"\n]*\{[^}\n]+\}|\bf'[^'\n]*(?:(?<!:)\/\/|\/\w+\[)[^'\n]*\{[^}\n]+\}/,
|
|
18704
|
+
fileRequires: PY_XPATH_FILE
|
|
18701
18705
|
},
|
|
18702
18706
|
{
|
|
18703
18707
|
id: "py-fast-password-hash",
|
|
@@ -19677,7 +19681,7 @@ var SECRET_RULES = [
|
|
|
19677
19681
|
keywordShaped: true
|
|
19678
19682
|
}
|
|
19679
19683
|
];
|
|
19680
|
-
var INTERPOLATION = String.raw`(?:\{\{[^}]*\}\}|\$\{[^}]*\}|\$[A-Za-z_]\w*|%[sdv])`;
|
|
19684
|
+
var INTERPOLATION = String.raw`(?:\{\{[^}]*\}\}|\$\{[^}]*\}|\$[A-Za-z_]\w*|%[sdv]|\{[^{}\s'"@/]+\}|<[A-Za-z_][\w.-]*>)`;
|
|
19681
19685
|
var KNOWN_PLACEHOLDERS = [
|
|
19682
19686
|
// Deliberately NOT here: AWS's published documentation key/secret pair
|
|
19683
19687
|
// (`AKIAIOSFODNN7EXAMPLE`, `wJalrXUtnFEMI/…`). GitHub allow-lists them, and
|
|
@@ -21670,14 +21674,12 @@ async function statusCommand() {
|
|
|
21670
21674
|
const pid = findRunningDaemon();
|
|
21671
21675
|
const client = new IpcClient();
|
|
21672
21676
|
let live = null;
|
|
21673
|
-
|
|
21674
|
-
|
|
21675
|
-
|
|
21676
|
-
|
|
21677
|
-
|
|
21678
|
-
|
|
21679
|
-
client.close();
|
|
21680
|
-
}
|
|
21677
|
+
try {
|
|
21678
|
+
await client.connect();
|
|
21679
|
+
live = await client.status();
|
|
21680
|
+
} catch {
|
|
21681
|
+
} finally {
|
|
21682
|
+
client.close();
|
|
21681
21683
|
}
|
|
21682
21684
|
console.log(source_default.green.bold(" Daemon Status"));
|
|
21683
21685
|
console.log(source_default.gray(" " + "\u2500".repeat(60)));
|
|
@@ -27453,18 +27455,26 @@ async function allowlistCommand(opts) {
|
|
|
27453
27455
|
const action = opts.action || "list";
|
|
27454
27456
|
console.log(source_default.green.bold(" Allowlist (never banned)"));
|
|
27455
27457
|
console.log(source_default.gray(" " + "\u2500".repeat(50)));
|
|
27458
|
+
const client = await connect();
|
|
27459
|
+
if (!client) return;
|
|
27460
|
+
let configPath = PATHS.configFile;
|
|
27461
|
+
let mode = null;
|
|
27462
|
+
try {
|
|
27463
|
+
const status = await client.status();
|
|
27464
|
+
configPath = status.paths.config;
|
|
27465
|
+
mode = status.mode;
|
|
27466
|
+
} catch {
|
|
27467
|
+
}
|
|
27456
27468
|
if (action === "list" || action === "ls") {
|
|
27457
|
-
const client = await connect();
|
|
27458
|
-
if (!client) return;
|
|
27459
27469
|
try {
|
|
27460
27470
|
const reply = await client.blocklist();
|
|
27461
27471
|
for (const entry of reply.protected) {
|
|
27462
27472
|
console.log(` ${source_default.green("\u26CA")} ${source_default.white(entry)}`);
|
|
27463
27473
|
}
|
|
27464
27474
|
console.log();
|
|
27465
|
-
console.log(source_default.gray(" Loopback, private ranges, the default gateway and
|
|
27466
|
-
console.log(source_default.gray("
|
|
27467
|
-
console.log(source_default.gray(` [remediation] protected = [...] in ${
|
|
27475
|
+
console.log(source_default.gray(" Loopback, private ranges, the default gateway and every live SSH"));
|
|
27476
|
+
console.log(source_default.gray(" peer are always protected. Add more under"));
|
|
27477
|
+
console.log(source_default.gray(` [remediation] protected = [...] in ${configPath}`));
|
|
27468
27478
|
} catch (err) {
|
|
27469
27479
|
console.log(` ${source_default.red("\u2717")} ${err.message}`);
|
|
27470
27480
|
} finally {
|
|
@@ -27473,12 +27483,15 @@ async function allowlistCommand(opts) {
|
|
|
27473
27483
|
}
|
|
27474
27484
|
return;
|
|
27475
27485
|
}
|
|
27476
|
-
|
|
27486
|
+
client.close();
|
|
27487
|
+
console.log(source_default.gray(` Edit ${configPath}:`));
|
|
27477
27488
|
console.log();
|
|
27478
27489
|
console.log(source_default.gray(" [remediation]"));
|
|
27479
27490
|
console.log(source_default.gray(` protected = ["${opts.value || "203.0.113.7/32"}"]`));
|
|
27480
27491
|
console.log();
|
|
27481
|
-
console.log(source_default.gray(
|
|
27492
|
+
console.log(source_default.gray(
|
|
27493
|
+
mode === "system" ? " then: sudo systemctl restart threatcrushd" : " then: threatcrush restart"
|
|
27494
|
+
));
|
|
27482
27495
|
console.log();
|
|
27483
27496
|
}
|
|
27484
27497
|
|