@profullstack/threatcrush 0.11.9 → 0.11.11
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 +25 -2
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +3883 -756
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/daemon.js
CHANGED
|
@@ -5505,7 +5505,9 @@ var CODE_RULES = [
|
|
|
5505
5505
|
guard: false,
|
|
5506
5506
|
// Installer instructions printed by the script do not execute. Matching
|
|
5507
5507
|
// them made a script report its own documentation as a network pipeline.
|
|
5508
|
-
lineGuard: /^\s*(?:echo|printf|say|info|warn|error)\s+["'][^"'\n]*\b(?:curl|wget)\b
|
|
5508
|
+
lineGuard: /^\s*(?:echo|printf|say|info|warn|error)\s+["'][^"'\n]*\b(?:curl|wget)\b/,
|
|
5509
|
+
// The same instructions written as a `cat <<USAGE` help block.
|
|
5510
|
+
displayedHeredocGuard: true
|
|
5509
5511
|
},
|
|
5510
5512
|
{
|
|
5511
5513
|
id: "sh-eval-expansion",
|
|
@@ -6178,6 +6180,23 @@ function bufferFilledBeforeUse(ctx) {
|
|
|
6178
6180
|
}
|
|
6179
6181
|
return false;
|
|
6180
6182
|
}
|
|
6183
|
+
var HEREDOC_OPENER = /<<(-?)\s*(['"]?)([A-Za-z_][\w]*)\2/;
|
|
6184
|
+
function insideDisplayedHeredoc(lines, index) {
|
|
6185
|
+
let open = null;
|
|
6186
|
+
for (let i = 0; i < index; i += 1) {
|
|
6187
|
+
const line = lines[i] ?? "";
|
|
6188
|
+
if (open) {
|
|
6189
|
+
if (line.trim() === open.terminator) open = null;
|
|
6190
|
+
continue;
|
|
6191
|
+
}
|
|
6192
|
+
if (line.includes("<<<")) continue;
|
|
6193
|
+
const found = HEREDOC_OPENER.exec(line);
|
|
6194
|
+
if (found) open = { terminator: found[3], opener: line };
|
|
6195
|
+
}
|
|
6196
|
+
if (!open) return false;
|
|
6197
|
+
const opener = open.opener.replace(/\s[12]?>&2\b/g, " ");
|
|
6198
|
+
return /^\s*cat\b/.test(opener) && !/>/.test(opener) && !/\|/.test(opener);
|
|
6199
|
+
}
|
|
6181
6200
|
function evaluateRule(rule, ctx) {
|
|
6182
6201
|
if (rule.languages && !rule.languages.includes(ctx.language)) return null;
|
|
6183
6202
|
const line = ctx.lines[ctx.index] ?? "";
|
|
@@ -6189,6 +6208,7 @@ function evaluateRule(rule, ctx) {
|
|
|
6189
6208
|
const context = windowText(ctx.lines, ctx.index, back, forward, ctx.prose);
|
|
6190
6209
|
if (rule.requires && !rule.requires.test(context)) return null;
|
|
6191
6210
|
if (rule.lineGuard?.test(line)) return null;
|
|
6211
|
+
if (rule.displayedHeredocGuard && insideDisplayedHeredoc(ctx.lines, ctx.index)) return null;
|
|
6192
6212
|
if (rule.enclosingCallGuard) {
|
|
6193
6213
|
const callees = enclosingCallees(ctx.lines, ctx.index, back);
|
|
6194
6214
|
if (callees.some((callee) => rule.enclosingCallGuard.test(callee))) return null;
|
|
@@ -6466,7 +6486,10 @@ var POPULAR_NPM = [
|
|
|
6466
6486
|
"svelte",
|
|
6467
6487
|
"angular",
|
|
6468
6488
|
"rxjs",
|
|
6469
|
-
"zod"
|
|
6489
|
+
"zod",
|
|
6490
|
+
// One edit from `react` and a popular framework in its own right: listing it
|
|
6491
|
+
// stops it being reported as a squat and starts protecting it from one.
|
|
6492
|
+
"preact"
|
|
6470
6493
|
];
|
|
6471
6494
|
var POPULAR_PYPI = [
|
|
6472
6495
|
"requests",
|