@node9/policy-engine 2.66.0 → 2.66.2
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/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +113 -6
- package/dist/index.mjs +113 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2503,7 +2503,7 @@ declare const LONG_OUTPUT_THRESHOLD_BYTES: number;
|
|
|
2503
2503
|
* and fails CI when the hash drifts without a version bump — forgetting
|
|
2504
2504
|
* is loud, not silent.
|
|
2505
2505
|
*/
|
|
2506
|
-
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
2506
|
+
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v43";
|
|
2507
2507
|
/**
|
|
2508
2508
|
* SHA-256 prefix of the detector-source files
|
|
2509
2509
|
* (canonical.ts + pii.ts + destructive-regex.ts).
|
|
@@ -2514,7 +2514,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v42";
|
|
|
2514
2514
|
* files changed, this hash must change too, and you must consciously
|
|
2515
2515
|
* decide whether to bump CANONICAL_EXTRACTOR_VERSION."
|
|
2516
2516
|
*/
|
|
2517
|
-
declare const CANONICAL_EXTRACTOR_HASH = "
|
|
2517
|
+
declare const CANONICAL_EXTRACTOR_HASH = "a60fbf5de2ecbdeb";
|
|
2518
2518
|
declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
|
|
2519
2519
|
declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
|
|
2520
2520
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2503,7 +2503,7 @@ declare const LONG_OUTPUT_THRESHOLD_BYTES: number;
|
|
|
2503
2503
|
* and fails CI when the hash drifts without a version bump — forgetting
|
|
2504
2504
|
* is loud, not silent.
|
|
2505
2505
|
*/
|
|
2506
|
-
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
2506
|
+
declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v43";
|
|
2507
2507
|
/**
|
|
2508
2508
|
* SHA-256 prefix of the detector-source files
|
|
2509
2509
|
* (canonical.ts + pii.ts + destructive-regex.ts).
|
|
@@ -2514,7 +2514,7 @@ declare const CANONICAL_EXTRACTOR_VERSION = "canonical-v42";
|
|
|
2514
2514
|
* files changed, this hash must change too, and you must consciously
|
|
2515
2515
|
* decide whether to bump CANONICAL_EXTRACTOR_VERSION."
|
|
2516
2516
|
*/
|
|
2517
|
-
declare const CANONICAL_EXTRACTOR_HASH = "
|
|
2517
|
+
declare const CANONICAL_EXTRACTOR_HASH = "a60fbf5de2ecbdeb";
|
|
2518
2518
|
declare function extractCanonicalFindings(call: ToolCallEntry, ctx: ExtractContext): CanonicalFinding[];
|
|
2519
2519
|
declare function extractSessionLevelFindings(calls: ReadonlyArray<SessionToolCall>, ctx: SessionExtractContext): CanonicalFinding[];
|
|
2520
2520
|
/**
|
package/dist/index.js
CHANGED
|
@@ -4556,8 +4556,13 @@ function collectShellFileAccesses(command, context = {}, report) {
|
|
|
4556
4556
|
}
|
|
4557
4557
|
function addUnknownRead(token, state) {
|
|
4558
4558
|
const prefix = token?.value ?? "";
|
|
4559
|
-
if (/^[
|
|
4559
|
+
if (/^[$]|^[A-Za-z]:/.test(prefix)) return;
|
|
4560
4560
|
const pattern = `${prefix.slice(0, prefix.lastIndexOf("/") + 1)}*`;
|
|
4561
|
+
if (/^[/~]/.test(prefix)) {
|
|
4562
|
+
if (pattern.length > 2)
|
|
4563
|
+
out.push({ operation: "read", path: pattern, cwd: "", followFinal: true, glob: pattern });
|
|
4564
|
+
return;
|
|
4565
|
+
}
|
|
4561
4566
|
for (const cwd of state.cwd)
|
|
4562
4567
|
if (cwd)
|
|
4563
4568
|
out.push({ operation: "read", path: pattern, cwd, followFinal: true, glob: pattern });
|
|
@@ -8708,7 +8713,7 @@ function analyzeCommandFs(command) {
|
|
|
8708
8713
|
}
|
|
8709
8714
|
const changesDir = CHANGES_DIR_RE.test(command) || CHANGES_DIR_RE.test(normalized);
|
|
8710
8715
|
const own = analyzeFsOperationImpl(command);
|
|
8711
|
-
const direct = (stdinShell || changesDir) && own?.verdict !== "block" ? stricter(own, structuralJailRead(command)) : own ?? (INDIRECT_SHAPE_RE.test(command) ? structuralJailRead(command) : null);
|
|
8716
|
+
const direct = (stdinShell || changesDir) && own?.verdict !== "block" ? stricter(own, structuralJailRead(command)) : own ?? (INDIRECT_SHAPE_RE.test(command) || namesCredentialDirLate(command) ? structuralJailRead(command) : null);
|
|
8712
8717
|
const withInline = direct?.verdict === "block" || !runsInlineInterpreter(command, normalized) ? direct : stricter(direct, inlineCodeJailRead(command, changesDir));
|
|
8713
8718
|
const computed = withInline?.verdict === "block" || !dotenvCli ? withInline : stricter(withInline, dotenvCliJailRead(command));
|
|
8714
8719
|
if (fsOpCache.size >= FS_OP_CACHE_MAX) {
|
|
@@ -9176,6 +9181,20 @@ function matchSensitivePath(p) {
|
|
|
9176
9181
|
return null;
|
|
9177
9182
|
}
|
|
9178
9183
|
var INDIRECT_SHAPE_RE = /\b(?:for|while|until|find|xargs|set|source)\b|\$\{?PWD\b|[*?[]|(?:^|[;&|(\s])\.\s/;
|
|
9184
|
+
var CREDENTIAL_DIR_NAME_RE = /\.(?:ssh|aws)(?![\w.-])/;
|
|
9185
|
+
function namesCredentialDirLate(command) {
|
|
9186
|
+
if (!/[$`]/.test(command) || !CREDENTIAL_DIR_NAME_RE.test(command)) return false;
|
|
9187
|
+
for (const word of command.split(/[\s;&|<>]+/)) {
|
|
9188
|
+
const at = word.search(/\.(?:ssh|aws)\//);
|
|
9189
|
+
if (at >= 0 && /[$`]/.test(word.slice(at))) return true;
|
|
9190
|
+
}
|
|
9191
|
+
if (command.split("`").some((seg, i) => i % 2 === 1 && CREDENTIAL_DIR_NAME_RE.test(seg)))
|
|
9192
|
+
return true;
|
|
9193
|
+
return command.split(")").some((seg) => {
|
|
9194
|
+
const open = seg.lastIndexOf("$(");
|
|
9195
|
+
return open >= 0 && CREDENTIAL_DIR_NAME_RE.test(seg.slice(open));
|
|
9196
|
+
});
|
|
9197
|
+
}
|
|
9179
9198
|
var STDIN_SHELL_WORD_RE = new RegExp(
|
|
9180
9199
|
`(?:^|[\\s;&|(/\\\\])(?:${[...SHELL_INTERPRETERS].map((name) => name.replace(/[.*+?^\${}()|[\]\\]/g, "\\$&")).join("|")})(?=$|[\\s;&|)<])`,
|
|
9181
9200
|
"i"
|
|
@@ -9317,6 +9336,94 @@ function findOfJailedNames(stmt) {
|
|
|
9317
9336
|
}
|
|
9318
9337
|
return null;
|
|
9319
9338
|
}
|
|
9339
|
+
function homeLedWord(word) {
|
|
9340
|
+
const literal = resolveWordLiteral(word);
|
|
9341
|
+
if (literal !== null) return literal;
|
|
9342
|
+
let parts = word?.Parts ?? [];
|
|
9343
|
+
if (parts.length === 1 && parts[0].kind === "DblQuoted") parts = parts[0].Parts ?? [];
|
|
9344
|
+
const first = parts[0];
|
|
9345
|
+
if (first?.kind !== "ParamExp" || first.Param?.Value !== "HOME") return null;
|
|
9346
|
+
if (first.Exp || first.Index || first.Length || first.Excl || first.Slice || first.Repl)
|
|
9347
|
+
return null;
|
|
9348
|
+
const rest = parts.length > 1 ? resolveWordLiteral({ Parts: parts.slice(1) }) : "";
|
|
9349
|
+
return rest === null ? null : `~${rest}`;
|
|
9350
|
+
}
|
|
9351
|
+
var PRIVATE_PROBE_NAMES = ["id_rsa", "id_ed25519", "id_ecdsa", "config", "credentials"];
|
|
9352
|
+
function credentialDirListing(stmt) {
|
|
9353
|
+
const cmd = stmt?.Cmd;
|
|
9354
|
+
if (cmd?.kind !== "CallExpr") return null;
|
|
9355
|
+
const words = (cmd.Args ?? []).map((a) => homeLedWord(a));
|
|
9356
|
+
const head = unwrapCommandHead(words);
|
|
9357
|
+
const name = baseWord(words[head]);
|
|
9358
|
+
const rest = words.slice(head + 1);
|
|
9359
|
+
let targets;
|
|
9360
|
+
if (name === "find") {
|
|
9361
|
+
for (let i = 0; i < rest.length; i++)
|
|
9362
|
+
if (rest[i] === "-type" && rest[i + 1] === "d") return null;
|
|
9363
|
+
const patterns = findNamePatterns(rest);
|
|
9364
|
+
const selectsPrivate = patterns.length === 0 || patterns.some(({ pattern, nocase }) => {
|
|
9365
|
+
try {
|
|
9366
|
+
const m = (0, import_picomatch.default)(shellGlob(pattern), { dot: true, nocase });
|
|
9367
|
+
return PRIVATE_PROBE_NAMES.some((n) => m(n));
|
|
9368
|
+
} catch {
|
|
9369
|
+
return true;
|
|
9370
|
+
}
|
|
9371
|
+
});
|
|
9372
|
+
if (!selectsPrivate) return null;
|
|
9373
|
+
targets = findStartPoints(words, head).starts;
|
|
9374
|
+
} else if (name === "ls") {
|
|
9375
|
+
targets = rest.filter((w) => w === null || !w.startsWith("-"));
|
|
9376
|
+
} else if (name === "fd" || name === "fdfind") {
|
|
9377
|
+
targets = rest.filter((w) => w === null || !w.startsWith("-")).slice(1);
|
|
9378
|
+
} else return null;
|
|
9379
|
+
for (const target of targets) {
|
|
9380
|
+
if (target === null) continue;
|
|
9381
|
+
const t = joinEntered(target, ".").replace(/[/\\]+$/, "");
|
|
9382
|
+
if (isPublicSshMaterial(t)) continue;
|
|
9383
|
+
if (GLOB_META.test(t)) {
|
|
9384
|
+
const hit2 = matchSensitiveGlob(t, name === "find");
|
|
9385
|
+
if (hit2?.verdict === "block") return hit2;
|
|
9386
|
+
continue;
|
|
9387
|
+
}
|
|
9388
|
+
const hit = matchSensitivePath(`${t}/n9-any-name`);
|
|
9389
|
+
if (hit?.verdict === "block") return { ...hit, path: `${t}/*` };
|
|
9390
|
+
}
|
|
9391
|
+
return null;
|
|
9392
|
+
}
|
|
9393
|
+
var listingVerdict = (stmt) => findOfJailedNames(stmt) ?? credentialDirListing(stmt);
|
|
9394
|
+
function listedNamesRead(command) {
|
|
9395
|
+
const f = parseShared(command);
|
|
9396
|
+
if (typeof f === "symbol") return null;
|
|
9397
|
+
const substVerdict = (node) => {
|
|
9398
|
+
let found = null;
|
|
9399
|
+
walk(node, (n) => {
|
|
9400
|
+
if (found) return false;
|
|
9401
|
+
if (n.kind !== "CmdSubst") return true;
|
|
9402
|
+
walk(n, (m) => {
|
|
9403
|
+
if (m?.Cmd) found ??= listingVerdict(m);
|
|
9404
|
+
return !found;
|
|
9405
|
+
});
|
|
9406
|
+
return false;
|
|
9407
|
+
});
|
|
9408
|
+
return found;
|
|
9409
|
+
};
|
|
9410
|
+
let hit = null;
|
|
9411
|
+
walk(f, (n) => {
|
|
9412
|
+
if (hit) return false;
|
|
9413
|
+
const node = n;
|
|
9414
|
+
if (node.kind === "CallExpr") {
|
|
9415
|
+
const words = callWords(node);
|
|
9416
|
+
if (isReaderWord(words[unwrapCommandHead(words)])) hit = substVerdict(node);
|
|
9417
|
+
} else if (node.kind === "ForClause") {
|
|
9418
|
+
const v = node.Loop?.Name?.Value;
|
|
9419
|
+
if (v && hasReader({ kind: "Block", Stmts: node.Do }, v)) {
|
|
9420
|
+
for (const item of node.Loop.Items ?? []) hit ??= substVerdict(item);
|
|
9421
|
+
}
|
|
9422
|
+
}
|
|
9423
|
+
return !hit;
|
|
9424
|
+
});
|
|
9425
|
+
return hit;
|
|
9426
|
+
}
|
|
9320
9427
|
var pipeOps = lazy(
|
|
9321
9428
|
() => new Set(
|
|
9322
9429
|
["a | b", "a |& b"].map((t) => {
|
|
@@ -9357,7 +9464,7 @@ function findPipedToReader(command) {
|
|
|
9357
9464
|
}
|
|
9358
9465
|
}
|
|
9359
9466
|
for (let i = 0; i < stages.length - 1 && !hit; i++) {
|
|
9360
|
-
const found =
|
|
9467
|
+
const found = listingVerdict(stages[i]);
|
|
9361
9468
|
if (found && stages.slice(i + 1).some(readsFedNames)) hit = found;
|
|
9362
9469
|
}
|
|
9363
9470
|
return !hit;
|
|
@@ -9544,7 +9651,7 @@ function structuralJailRead(command) {
|
|
|
9544
9651
|
} catch {
|
|
9545
9652
|
return null;
|
|
9546
9653
|
}
|
|
9547
|
-
const piped = findPipedToReader(command);
|
|
9654
|
+
const piped = findPipedToReader(command) ?? listedNamesRead(command);
|
|
9548
9655
|
if (piped) return piped;
|
|
9549
9656
|
const sourcedHit = sourcedAndPrinted(command);
|
|
9550
9657
|
if (sourcedHit?.verdict === "block") return sourcedHit;
|
|
@@ -21882,8 +21989,8 @@ function matchCanaryArgs(args, values) {
|
|
|
21882
21989
|
|
|
21883
21990
|
// src/scan/canonical.ts
|
|
21884
21991
|
var LONG_OUTPUT_THRESHOLD_BYTES = 100 * 1024;
|
|
21885
|
-
var CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
21886
|
-
var CANONICAL_EXTRACTOR_HASH = "
|
|
21992
|
+
var CANONICAL_EXTRACTOR_VERSION = "canonical-v43";
|
|
21993
|
+
var CANONICAL_EXTRACTOR_HASH = "a60fbf5de2ecbdeb";
|
|
21887
21994
|
var DEDUPE_PREVIEW_LEN = 120;
|
|
21888
21995
|
function extractCanonicalFindings(call, ctx) {
|
|
21889
21996
|
const out = [];
|
package/dist/index.mjs
CHANGED
|
@@ -4286,8 +4286,13 @@ function collectShellFileAccesses(command, context = {}, report) {
|
|
|
4286
4286
|
}
|
|
4287
4287
|
function addUnknownRead(token, state) {
|
|
4288
4288
|
const prefix = token?.value ?? "";
|
|
4289
|
-
if (/^[
|
|
4289
|
+
if (/^[$]|^[A-Za-z]:/.test(prefix)) return;
|
|
4290
4290
|
const pattern = `${prefix.slice(0, prefix.lastIndexOf("/") + 1)}*`;
|
|
4291
|
+
if (/^[/~]/.test(prefix)) {
|
|
4292
|
+
if (pattern.length > 2)
|
|
4293
|
+
out.push({ operation: "read", path: pattern, cwd: "", followFinal: true, glob: pattern });
|
|
4294
|
+
return;
|
|
4295
|
+
}
|
|
4291
4296
|
for (const cwd of state.cwd)
|
|
4292
4297
|
if (cwd)
|
|
4293
4298
|
out.push({ operation: "read", path: pattern, cwd, followFinal: true, glob: pattern });
|
|
@@ -8438,7 +8443,7 @@ function analyzeCommandFs(command) {
|
|
|
8438
8443
|
}
|
|
8439
8444
|
const changesDir = CHANGES_DIR_RE.test(command) || CHANGES_DIR_RE.test(normalized);
|
|
8440
8445
|
const own = analyzeFsOperationImpl(command);
|
|
8441
|
-
const direct = (stdinShell || changesDir) && own?.verdict !== "block" ? stricter(own, structuralJailRead(command)) : own ?? (INDIRECT_SHAPE_RE.test(command) ? structuralJailRead(command) : null);
|
|
8446
|
+
const direct = (stdinShell || changesDir) && own?.verdict !== "block" ? stricter(own, structuralJailRead(command)) : own ?? (INDIRECT_SHAPE_RE.test(command) || namesCredentialDirLate(command) ? structuralJailRead(command) : null);
|
|
8442
8447
|
const withInline = direct?.verdict === "block" || !runsInlineInterpreter(command, normalized) ? direct : stricter(direct, inlineCodeJailRead(command, changesDir));
|
|
8443
8448
|
const computed = withInline?.verdict === "block" || !dotenvCli ? withInline : stricter(withInline, dotenvCliJailRead(command));
|
|
8444
8449
|
if (fsOpCache.size >= FS_OP_CACHE_MAX) {
|
|
@@ -8906,6 +8911,20 @@ function matchSensitivePath(p) {
|
|
|
8906
8911
|
return null;
|
|
8907
8912
|
}
|
|
8908
8913
|
var INDIRECT_SHAPE_RE = /\b(?:for|while|until|find|xargs|set|source)\b|\$\{?PWD\b|[*?[]|(?:^|[;&|(\s])\.\s/;
|
|
8914
|
+
var CREDENTIAL_DIR_NAME_RE = /\.(?:ssh|aws)(?![\w.-])/;
|
|
8915
|
+
function namesCredentialDirLate(command) {
|
|
8916
|
+
if (!/[$`]/.test(command) || !CREDENTIAL_DIR_NAME_RE.test(command)) return false;
|
|
8917
|
+
for (const word of command.split(/[\s;&|<>]+/)) {
|
|
8918
|
+
const at = word.search(/\.(?:ssh|aws)\//);
|
|
8919
|
+
if (at >= 0 && /[$`]/.test(word.slice(at))) return true;
|
|
8920
|
+
}
|
|
8921
|
+
if (command.split("`").some((seg, i) => i % 2 === 1 && CREDENTIAL_DIR_NAME_RE.test(seg)))
|
|
8922
|
+
return true;
|
|
8923
|
+
return command.split(")").some((seg) => {
|
|
8924
|
+
const open = seg.lastIndexOf("$(");
|
|
8925
|
+
return open >= 0 && CREDENTIAL_DIR_NAME_RE.test(seg.slice(open));
|
|
8926
|
+
});
|
|
8927
|
+
}
|
|
8909
8928
|
var STDIN_SHELL_WORD_RE = new RegExp(
|
|
8910
8929
|
`(?:^|[\\s;&|(/\\\\])(?:${[...SHELL_INTERPRETERS].map((name) => name.replace(/[.*+?^\${}()|[\]\\]/g, "\\$&")).join("|")})(?=$|[\\s;&|)<])`,
|
|
8911
8930
|
"i"
|
|
@@ -9047,6 +9066,94 @@ function findOfJailedNames(stmt) {
|
|
|
9047
9066
|
}
|
|
9048
9067
|
return null;
|
|
9049
9068
|
}
|
|
9069
|
+
function homeLedWord(word) {
|
|
9070
|
+
const literal = resolveWordLiteral(word);
|
|
9071
|
+
if (literal !== null) return literal;
|
|
9072
|
+
let parts = word?.Parts ?? [];
|
|
9073
|
+
if (parts.length === 1 && parts[0].kind === "DblQuoted") parts = parts[0].Parts ?? [];
|
|
9074
|
+
const first = parts[0];
|
|
9075
|
+
if (first?.kind !== "ParamExp" || first.Param?.Value !== "HOME") return null;
|
|
9076
|
+
if (first.Exp || first.Index || first.Length || first.Excl || first.Slice || first.Repl)
|
|
9077
|
+
return null;
|
|
9078
|
+
const rest = parts.length > 1 ? resolveWordLiteral({ Parts: parts.slice(1) }) : "";
|
|
9079
|
+
return rest === null ? null : `~${rest}`;
|
|
9080
|
+
}
|
|
9081
|
+
var PRIVATE_PROBE_NAMES = ["id_rsa", "id_ed25519", "id_ecdsa", "config", "credentials"];
|
|
9082
|
+
function credentialDirListing(stmt) {
|
|
9083
|
+
const cmd = stmt?.Cmd;
|
|
9084
|
+
if (cmd?.kind !== "CallExpr") return null;
|
|
9085
|
+
const words = (cmd.Args ?? []).map((a) => homeLedWord(a));
|
|
9086
|
+
const head = unwrapCommandHead(words);
|
|
9087
|
+
const name = baseWord(words[head]);
|
|
9088
|
+
const rest = words.slice(head + 1);
|
|
9089
|
+
let targets;
|
|
9090
|
+
if (name === "find") {
|
|
9091
|
+
for (let i = 0; i < rest.length; i++)
|
|
9092
|
+
if (rest[i] === "-type" && rest[i + 1] === "d") return null;
|
|
9093
|
+
const patterns = findNamePatterns(rest);
|
|
9094
|
+
const selectsPrivate = patterns.length === 0 || patterns.some(({ pattern, nocase }) => {
|
|
9095
|
+
try {
|
|
9096
|
+
const m = picomatch(shellGlob(pattern), { dot: true, nocase });
|
|
9097
|
+
return PRIVATE_PROBE_NAMES.some((n) => m(n));
|
|
9098
|
+
} catch {
|
|
9099
|
+
return true;
|
|
9100
|
+
}
|
|
9101
|
+
});
|
|
9102
|
+
if (!selectsPrivate) return null;
|
|
9103
|
+
targets = findStartPoints(words, head).starts;
|
|
9104
|
+
} else if (name === "ls") {
|
|
9105
|
+
targets = rest.filter((w) => w === null || !w.startsWith("-"));
|
|
9106
|
+
} else if (name === "fd" || name === "fdfind") {
|
|
9107
|
+
targets = rest.filter((w) => w === null || !w.startsWith("-")).slice(1);
|
|
9108
|
+
} else return null;
|
|
9109
|
+
for (const target of targets) {
|
|
9110
|
+
if (target === null) continue;
|
|
9111
|
+
const t = joinEntered(target, ".").replace(/[/\\]+$/, "");
|
|
9112
|
+
if (isPublicSshMaterial(t)) continue;
|
|
9113
|
+
if (GLOB_META.test(t)) {
|
|
9114
|
+
const hit2 = matchSensitiveGlob(t, name === "find");
|
|
9115
|
+
if (hit2?.verdict === "block") return hit2;
|
|
9116
|
+
continue;
|
|
9117
|
+
}
|
|
9118
|
+
const hit = matchSensitivePath(`${t}/n9-any-name`);
|
|
9119
|
+
if (hit?.verdict === "block") return { ...hit, path: `${t}/*` };
|
|
9120
|
+
}
|
|
9121
|
+
return null;
|
|
9122
|
+
}
|
|
9123
|
+
var listingVerdict = (stmt) => findOfJailedNames(stmt) ?? credentialDirListing(stmt);
|
|
9124
|
+
function listedNamesRead(command) {
|
|
9125
|
+
const f = parseShared(command);
|
|
9126
|
+
if (typeof f === "symbol") return null;
|
|
9127
|
+
const substVerdict = (node) => {
|
|
9128
|
+
let found = null;
|
|
9129
|
+
walk(node, (n) => {
|
|
9130
|
+
if (found) return false;
|
|
9131
|
+
if (n.kind !== "CmdSubst") return true;
|
|
9132
|
+
walk(n, (m) => {
|
|
9133
|
+
if (m?.Cmd) found ??= listingVerdict(m);
|
|
9134
|
+
return !found;
|
|
9135
|
+
});
|
|
9136
|
+
return false;
|
|
9137
|
+
});
|
|
9138
|
+
return found;
|
|
9139
|
+
};
|
|
9140
|
+
let hit = null;
|
|
9141
|
+
walk(f, (n) => {
|
|
9142
|
+
if (hit) return false;
|
|
9143
|
+
const node = n;
|
|
9144
|
+
if (node.kind === "CallExpr") {
|
|
9145
|
+
const words = callWords(node);
|
|
9146
|
+
if (isReaderWord(words[unwrapCommandHead(words)])) hit = substVerdict(node);
|
|
9147
|
+
} else if (node.kind === "ForClause") {
|
|
9148
|
+
const v = node.Loop?.Name?.Value;
|
|
9149
|
+
if (v && hasReader({ kind: "Block", Stmts: node.Do }, v)) {
|
|
9150
|
+
for (const item of node.Loop.Items ?? []) hit ??= substVerdict(item);
|
|
9151
|
+
}
|
|
9152
|
+
}
|
|
9153
|
+
return !hit;
|
|
9154
|
+
});
|
|
9155
|
+
return hit;
|
|
9156
|
+
}
|
|
9050
9157
|
var pipeOps = lazy(
|
|
9051
9158
|
() => new Set(
|
|
9052
9159
|
["a | b", "a |& b"].map((t) => {
|
|
@@ -9087,7 +9194,7 @@ function findPipedToReader(command) {
|
|
|
9087
9194
|
}
|
|
9088
9195
|
}
|
|
9089
9196
|
for (let i = 0; i < stages.length - 1 && !hit; i++) {
|
|
9090
|
-
const found =
|
|
9197
|
+
const found = listingVerdict(stages[i]);
|
|
9091
9198
|
if (found && stages.slice(i + 1).some(readsFedNames)) hit = found;
|
|
9092
9199
|
}
|
|
9093
9200
|
return !hit;
|
|
@@ -9274,7 +9381,7 @@ function structuralJailRead(command) {
|
|
|
9274
9381
|
} catch {
|
|
9275
9382
|
return null;
|
|
9276
9383
|
}
|
|
9277
|
-
const piped = findPipedToReader(command);
|
|
9384
|
+
const piped = findPipedToReader(command) ?? listedNamesRead(command);
|
|
9278
9385
|
if (piped) return piped;
|
|
9279
9386
|
const sourcedHit = sourcedAndPrinted(command);
|
|
9280
9387
|
if (sourcedHit?.verdict === "block") return sourcedHit;
|
|
@@ -21612,8 +21719,8 @@ function matchCanaryArgs(args, values) {
|
|
|
21612
21719
|
|
|
21613
21720
|
// src/scan/canonical.ts
|
|
21614
21721
|
var LONG_OUTPUT_THRESHOLD_BYTES = 100 * 1024;
|
|
21615
|
-
var CANONICAL_EXTRACTOR_VERSION = "canonical-
|
|
21616
|
-
var CANONICAL_EXTRACTOR_HASH = "
|
|
21722
|
+
var CANONICAL_EXTRACTOR_VERSION = "canonical-v43";
|
|
21723
|
+
var CANONICAL_EXTRACTOR_HASH = "a60fbf5de2ecbdeb";
|
|
21617
21724
|
var DEDUPE_PREVIEW_LEN = 120;
|
|
21618
21725
|
function extractCanonicalFindings(call, ctx) {
|
|
21619
21726
|
const out = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node9/policy-engine",
|
|
3
|
-
"version": "2.66.
|
|
3
|
+
"version": "2.66.2",
|
|
4
4
|
"description": "Shared policy evaluation engine for node9 — DLP, smart rules, AST shell parsing, shields, loop detection. Pure functions, no I/O. Used by both node9-proxy and the node9 SaaS firewall.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://node9.ai",
|