@node9/policy-engine 2.31.2 → 2.32.0
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 +89 -2
- package/dist/index.d.ts +89 -2
- package/dist/index.js +827 -55
- package/dist/index.mjs +813 -55
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -927,10 +927,10 @@ function compressIpv6(g) {
|
|
|
927
927
|
if (bestLen < 2) return hex.join(":");
|
|
928
928
|
return hex.slice(0, bestStart).join(":") + "::" + hex.slice(bestStart + bestLen).join(":");
|
|
929
929
|
}
|
|
930
|
-
function normalizeIpLiteral(
|
|
930
|
+
function normalizeIpLiteral(host2) {
|
|
931
931
|
try {
|
|
932
|
-
if (typeof
|
|
933
|
-
let s =
|
|
932
|
+
if (typeof host2 !== "string") return null;
|
|
933
|
+
let s = host2.trim();
|
|
934
934
|
if (!s || s.length > SSRF_MAX_HOST) return null;
|
|
935
935
|
if (s.startsWith("[") && s.endsWith("]")) s = s.slice(1, -1);
|
|
936
936
|
const zone = s.indexOf("%");
|
|
@@ -977,11 +977,11 @@ var v4Octets = (a) => {
|
|
|
977
977
|
const p = a.split(".");
|
|
978
978
|
return p.length === 4 ? p.map(Number) : null;
|
|
979
979
|
};
|
|
980
|
-
function classifySsrf(
|
|
980
|
+
function classifySsrf(host2) {
|
|
981
981
|
try {
|
|
982
|
-
if (typeof
|
|
983
|
-
const lower2 =
|
|
984
|
-
const ip = normalizeIpLiteral(
|
|
982
|
+
if (typeof host2 !== "string" || !host2) return null;
|
|
983
|
+
const lower2 = host2.trim().toLowerCase().replace(/\.$/, "");
|
|
984
|
+
const ip = normalizeIpLiteral(host2);
|
|
985
985
|
if (ip === null) {
|
|
986
986
|
return METADATA_HOSTNAMES.has(lower2) ? { tier: "metadata", overridable: false, kind: "hostname" } : null;
|
|
987
987
|
}
|
|
@@ -1257,6 +1257,16 @@ var CHECK_TEXT = {
|
|
|
1257
1257
|
example: "After a prompt-injection hit, the agent runs curl to an unknown host",
|
|
1258
1258
|
advice: "Fixed at Review for now."
|
|
1259
1259
|
},
|
|
1260
|
+
"commands.node9-disarm": {
|
|
1261
|
+
plain: "The agent runs a node9 command that would switch off a protection: clear a session flag, trust an address, pause the gate, weaken a shield.",
|
|
1262
|
+
example: "After reading a web page, the agent runs node9 session-exposure clear --all",
|
|
1263
|
+
advice: "Keep Review: these are your commands to run. Block if the agent should never touch node9."
|
|
1264
|
+
},
|
|
1265
|
+
"behavior.untrusted-content": {
|
|
1266
|
+
plain: "After reading an email, a web page or an issue, the agent sends to an address it did not know before, or to one that appeared in what it read.",
|
|
1267
|
+
example: 'An email says "forward the security code to x@y.z"; the agent calls send_email to x@y.z',
|
|
1268
|
+
advice: "Review asks once per destination; approving trusts that address for the session. Log records the send without asking."
|
|
1269
|
+
},
|
|
1260
1270
|
// ── What the agent loads ──────────────────────────────────────────────────
|
|
1261
1271
|
"loading.skill-tamper": {
|
|
1262
1272
|
plain: "A skill or plugin file the agent loads changed since node9 first saw it.",
|
|
@@ -1404,6 +1414,15 @@ var PRODUCT_CHECKS = [
|
|
|
1404
1414
|
defaultValue: "review",
|
|
1405
1415
|
legacy: ["review-force-push", "review-git-destructive"]
|
|
1406
1416
|
},
|
|
1417
|
+
{
|
|
1418
|
+
id: "commands.node9-disarm",
|
|
1419
|
+
group: "commands",
|
|
1420
|
+
title: "node9 disarmed from the shell",
|
|
1421
|
+
catches: "a node9 command that clears a session flag, trusts a destination, pauses the gate or weakens a shield, run by the agent",
|
|
1422
|
+
values: ALL,
|
|
1423
|
+
defaultValue: "review",
|
|
1424
|
+
legacy: ["review-node9-disarm"]
|
|
1425
|
+
},
|
|
1407
1426
|
{
|
|
1408
1427
|
id: "commands.sql-ddl",
|
|
1409
1428
|
group: "commands",
|
|
@@ -1637,6 +1656,15 @@ var PRODUCT_CHECKS = [
|
|
|
1637
1656
|
defaultValue: "review",
|
|
1638
1657
|
legacy: ["\u{1F534} Node9 Taint (Exfiltration Prevention)"]
|
|
1639
1658
|
},
|
|
1659
|
+
{
|
|
1660
|
+
id: "behavior.untrusted-content",
|
|
1661
|
+
group: "behavior",
|
|
1662
|
+
title: "Send after reading outside content",
|
|
1663
|
+
catches: "a send to an unknown destination, a destination found in what was read, or a destructive call after the session read an email, a web page or an issue",
|
|
1664
|
+
values: ["off", "log", "review"],
|
|
1665
|
+
defaultValue: "review",
|
|
1666
|
+
legacy: ["\u{1F6E1}\uFE0F Node9 Exposure", "exposure"]
|
|
1667
|
+
},
|
|
1640
1668
|
// ── What the agent loads ────────────────────────────────────────────────
|
|
1641
1669
|
{
|
|
1642
1670
|
id: "loading.skill-tamper",
|
|
@@ -1801,6 +1829,7 @@ function catalogSettingsFromConfig(settings, policy) {
|
|
|
1801
1829
|
injectionScan: policy.injectionScan,
|
|
1802
1830
|
skillPinning: policy.skillPinning,
|
|
1803
1831
|
packageCheck: policy.packageCheck,
|
|
1832
|
+
untrustedContent: policy.untrustedContent,
|
|
1804
1833
|
appliedShields: policy.appliedShields ?? [],
|
|
1805
1834
|
checks: policy.checks
|
|
1806
1835
|
};
|
|
@@ -1847,6 +1876,11 @@ var LEGACY_READERS = {
|
|
|
1847
1876
|
if (s.packageCheck?.enabled === void 0) return void 0;
|
|
1848
1877
|
if (!s.packageCheck.enabled) return "off";
|
|
1849
1878
|
return s.packageCheck.onMalicious === "review" ? "review" : "block";
|
|
1879
|
+
},
|
|
1880
|
+
"behavior.untrusted-content": (s) => {
|
|
1881
|
+
if (s.untrustedContent?.enabled === void 0) return void 0;
|
|
1882
|
+
if (!s.untrustedContent.enabled) return "off";
|
|
1883
|
+
return s.untrustedContent.afterExposure === "log-only" ? "log" : "review";
|
|
1850
1884
|
}
|
|
1851
1885
|
};
|
|
1852
1886
|
function resolveCheck(settings, id) {
|
|
@@ -3066,11 +3100,11 @@ function inlineExecStmt(stmt, pipeFed) {
|
|
|
3066
3100
|
const firstFlag = args.findIndex((a) => a == null || a.startsWith("-"));
|
|
3067
3101
|
args = firstFlag >= 0 ? args.slice(firstFlag) : [];
|
|
3068
3102
|
}
|
|
3069
|
-
let
|
|
3103
|
+
let positionals2 = 0;
|
|
3070
3104
|
let selectedProgram = false;
|
|
3071
3105
|
for (const a of args) {
|
|
3072
3106
|
if (a == null) {
|
|
3073
|
-
|
|
3107
|
+
positionals2++;
|
|
3074
3108
|
selectedProgram = true;
|
|
3075
3109
|
continue;
|
|
3076
3110
|
}
|
|
@@ -3081,13 +3115,13 @@ function inlineExecStmt(stmt, pipeFed) {
|
|
|
3081
3115
|
}
|
|
3082
3116
|
if (a === "-" && !selectedProgram) return true;
|
|
3083
3117
|
if (!a.startsWith("-")) {
|
|
3084
|
-
|
|
3118
|
+
positionals2++;
|
|
3085
3119
|
selectedProgram = true;
|
|
3086
3120
|
}
|
|
3087
3121
|
}
|
|
3088
3122
|
const redirs = stmt.Redirs || cmd.Redirs || [];
|
|
3089
3123
|
const stdinFed = redirs.some((r) => r && redirStdinOps().has(r.Op));
|
|
3090
|
-
if (
|
|
3124
|
+
if (positionals2 === 0 && (stdinFed || pipeFed)) {
|
|
3091
3125
|
if (!/^(bash|sh|zsh)$/i.test(interp)) return true;
|
|
3092
3126
|
}
|
|
3093
3127
|
return false;
|
|
@@ -3467,6 +3501,24 @@ function resolveWordLiteral(w) {
|
|
|
3467
3501
|
}
|
|
3468
3502
|
return s;
|
|
3469
3503
|
}
|
|
3504
|
+
function resolveWordPrefix(w) {
|
|
3505
|
+
const walk2 = (parts) => {
|
|
3506
|
+
let s = "";
|
|
3507
|
+
for (const p of parts) {
|
|
3508
|
+
if (p && typeof p === "object" && Array.isArray(p.Parts) && p.Dollar !== void 0) {
|
|
3509
|
+
const inner = walk2(p.Parts);
|
|
3510
|
+
s += inner.prefix;
|
|
3511
|
+
if (inner.dynamic) return { prefix: s, dynamic: true };
|
|
3512
|
+
continue;
|
|
3513
|
+
}
|
|
3514
|
+
const piece = resolvePart(p, false);
|
|
3515
|
+
if (piece === void 0 || piece === null) return { prefix: s, dynamic: true };
|
|
3516
|
+
s += piece;
|
|
3517
|
+
}
|
|
3518
|
+
return { prefix: s, dynamic: false };
|
|
3519
|
+
};
|
|
3520
|
+
return walk2(w?.Parts || []);
|
|
3521
|
+
}
|
|
3470
3522
|
function resolvePart(p, inQuotes) {
|
|
3471
3523
|
const t = syntax.NodeType(p);
|
|
3472
3524
|
if (t === "Lit") {
|
|
@@ -3514,7 +3566,7 @@ function parseDestHost(token) {
|
|
|
3514
3566
|
}
|
|
3515
3567
|
function destTokensForBinary(binary, args) {
|
|
3516
3568
|
const valueFlags = VALUE_FLAGS[binary] ?? /* @__PURE__ */ new Set();
|
|
3517
|
-
const
|
|
3569
|
+
const positionals2 = [];
|
|
3518
3570
|
const urlFlagValues = [];
|
|
3519
3571
|
for (let i = 0; i < args.length; i++) {
|
|
3520
3572
|
const tok = args[i];
|
|
@@ -3534,21 +3586,21 @@ function destTokensForBinary(binary, args) {
|
|
|
3534
3586
|
if (valueFlags.has(tok)) i++;
|
|
3535
3587
|
continue;
|
|
3536
3588
|
}
|
|
3537
|
-
|
|
3589
|
+
positionals2.push(tok);
|
|
3538
3590
|
}
|
|
3539
3591
|
switch (binary) {
|
|
3540
3592
|
case "curl":
|
|
3541
3593
|
case "wget":
|
|
3542
|
-
return [...urlFlagValues, ...
|
|
3594
|
+
return [...urlFlagValues, ...positionals2];
|
|
3543
3595
|
case "ssh":
|
|
3544
|
-
return
|
|
3596
|
+
return positionals2.slice(0, 1);
|
|
3545
3597
|
case "scp":
|
|
3546
3598
|
case "rsync":
|
|
3547
|
-
return
|
|
3599
|
+
return positionals2.filter((p) => p.includes(":") || p.includes("@"));
|
|
3548
3600
|
case "nc":
|
|
3549
3601
|
case "ncat":
|
|
3550
3602
|
case "netcat":
|
|
3551
|
-
return
|
|
3603
|
+
return positionals2.slice(0, 1);
|
|
3552
3604
|
default:
|
|
3553
3605
|
return [];
|
|
3554
3606
|
}
|
|
@@ -3565,16 +3617,18 @@ function extractShellDestinations(command) {
|
|
|
3565
3617
|
if (syntax.NodeType(n) !== "CallExpr") return true;
|
|
3566
3618
|
const callArgs = n.Args || [];
|
|
3567
3619
|
if (callArgs.length === 0) return true;
|
|
3568
|
-
const
|
|
3620
|
+
const words = callArgs.map((a) => resolveWordLiteral(a));
|
|
3621
|
+
const at = unwrapCommandHead(words);
|
|
3622
|
+
const name = (words[at] || "").toLowerCase().split("/").pop() ?? "";
|
|
3569
3623
|
if (!NET_BINARIES.has(name)) return true;
|
|
3570
|
-
const rest =
|
|
3624
|
+
const rest = words.slice(at + 1);
|
|
3571
3625
|
for (const raw of destTokensForBinary(name, rest)) {
|
|
3572
|
-
const
|
|
3573
|
-
if (!
|
|
3574
|
-
const key = `${name}:${
|
|
3626
|
+
const host2 = parseDestHost(raw);
|
|
3627
|
+
if (!host2) continue;
|
|
3628
|
+
const key = `${name}:${host2}`;
|
|
3575
3629
|
if (seen.has(key)) continue;
|
|
3576
3630
|
seen.add(key);
|
|
3577
|
-
out.push({ host, binary: name, raw });
|
|
3631
|
+
out.push({ host: host2, binary: name, raw });
|
|
3578
3632
|
}
|
|
3579
3633
|
return true;
|
|
3580
3634
|
});
|
|
@@ -5108,6 +5162,33 @@ var SYSTEM_AUTH_FILES = [
|
|
|
5108
5162
|
var SYSTEM_AUTH_DIRS = ["/etc/security", "/etc/pam.d", "/etc/sudoers.d"];
|
|
5109
5163
|
var PASSWORD_HASH_FILES = ["/etc/shadow", "/etc/gshadow"];
|
|
5110
5164
|
var STARTUP_NAMES = [".bashrc", ".zshrc", ".profile", ".bash_profile"];
|
|
5165
|
+
var AGENT_INSTRUCTION_FILES = [
|
|
5166
|
+
".gitlab-ci.yml",
|
|
5167
|
+
"CLAUDE.md",
|
|
5168
|
+
"AGENTS.md",
|
|
5169
|
+
".cursorrules",
|
|
5170
|
+
".mcp.json",
|
|
5171
|
+
".vscode/settings.json",
|
|
5172
|
+
"package.json"
|
|
5173
|
+
];
|
|
5174
|
+
var AGENT_INSTRUCTION_DIRS = [
|
|
5175
|
+
".github/workflows",
|
|
5176
|
+
".claude",
|
|
5177
|
+
".cursor",
|
|
5178
|
+
".git/hooks",
|
|
5179
|
+
".husky"
|
|
5180
|
+
];
|
|
5181
|
+
function isAgentInstructionPath(absPath, root) {
|
|
5182
|
+
const r = root.replace(/\/$/, "");
|
|
5183
|
+
if (!(absPath === r || absPath.startsWith(r + "/"))) return false;
|
|
5184
|
+
const rel = absPath.slice(r.length + 1);
|
|
5185
|
+
if (AGENT_INSTRUCTION_FILES.includes(rel)) return true;
|
|
5186
|
+
return AGENT_INSTRUCTION_DIRS.some((d) => rel === d || rel.startsWith(d + "/"));
|
|
5187
|
+
}
|
|
5188
|
+
function isInside(root, p) {
|
|
5189
|
+
const r = root.replace(/\/$/, "") || "/";
|
|
5190
|
+
return p === r || p.startsWith(r === "/" ? "/" : r + "/");
|
|
5191
|
+
}
|
|
5111
5192
|
var LEGACY_SYSTEM_PATH_RE = /^(?:[a-zA-Z]:)?\/etc\/(?:passwd|shadow|sudoers)$/;
|
|
5112
5193
|
function isPasswordHashPath(p) {
|
|
5113
5194
|
return PASSWORD_HASH_FILES.includes(p);
|
|
@@ -9322,7 +9403,25 @@ var TUNING_FIELDS = [
|
|
|
9322
9403
|
name: "onlineFallback",
|
|
9323
9404
|
legacy: ["packageCheck", "onlineFallback"]
|
|
9324
9405
|
},
|
|
9325
|
-
{ checkId: "loading.malicious-package", name: "allow", legacy: ["packageCheck", "allow"] }
|
|
9406
|
+
{ checkId: "loading.malicious-package", name: "allow", legacy: ["packageCheck", "allow"] },
|
|
9407
|
+
// fw#318: the verdict carries off / log (log-only) / review; the tuning
|
|
9408
|
+
// carries whether a review asks once per destination or every time, the
|
|
9409
|
+
// frame around outside content, and the organisation's own domains.
|
|
9410
|
+
{
|
|
9411
|
+
checkId: "behavior.untrusted-content",
|
|
9412
|
+
name: "afterExposure",
|
|
9413
|
+
legacy: ["untrustedContent", "afterExposure"]
|
|
9414
|
+
},
|
|
9415
|
+
{
|
|
9416
|
+
checkId: "behavior.untrusted-content",
|
|
9417
|
+
name: "spotlight",
|
|
9418
|
+
legacy: ["untrustedContent", "spotlight"]
|
|
9419
|
+
},
|
|
9420
|
+
{
|
|
9421
|
+
checkId: "behavior.untrusted-content",
|
|
9422
|
+
name: "orgDomains",
|
|
9423
|
+
legacy: ["untrustedContent", "orgDomains"]
|
|
9424
|
+
}
|
|
9326
9425
|
];
|
|
9327
9426
|
function tuningFromLegacyPolicy(policy) {
|
|
9328
9427
|
const out = {};
|
|
@@ -9401,6 +9500,10 @@ function checksFromLegacyPolicy(policy, mode) {
|
|
|
9401
9500
|
if (pkg?.enabled === false) out["loading.malicious-package"] = "off";
|
|
9402
9501
|
else if (pkg?.enabled === true)
|
|
9403
9502
|
out["loading.malicious-package"] = pkg.onMalicious === "review" ? "review" : "block";
|
|
9503
|
+
const uc = policy.untrustedContent;
|
|
9504
|
+
if (uc?.enabled === false) out["behavior.untrusted-content"] = "off";
|
|
9505
|
+
else if (uc?.enabled === true)
|
|
9506
|
+
out["behavior.untrusted-content"] = uc.afterExposure === "log-only" ? "log" : "review";
|
|
9404
9507
|
if (mode === "strict") out["commands.unknown"] = "review";
|
|
9405
9508
|
return out;
|
|
9406
9509
|
}
|
|
@@ -9482,6 +9585,13 @@ function checkToLegacyPolicy(policy, id, v) {
|
|
|
9482
9585
|
return offOr("packageCheck", () => {
|
|
9483
9586
|
obj("packageCheck").onMalicious = v === "review" ? "review" : "block";
|
|
9484
9587
|
});
|
|
9588
|
+
case "behavior.untrusted-content":
|
|
9589
|
+
if (v !== "off" && v !== "log" && v !== "review") return false;
|
|
9590
|
+
return offOr("untrustedContent", () => {
|
|
9591
|
+
const uc = obj("untrustedContent");
|
|
9592
|
+
if (v === "log") uc.afterExposure = "log-only";
|
|
9593
|
+
else if (uc.afterExposure !== "ask-every-time") uc.afterExposure = "ask-once";
|
|
9594
|
+
});
|
|
9485
9595
|
default:
|
|
9486
9596
|
return false;
|
|
9487
9597
|
}
|
|
@@ -9501,6 +9611,7 @@ var MAP_GOVERNED = /* @__PURE__ */ new Set([
|
|
|
9501
9611
|
"commands.temp-binary",
|
|
9502
9612
|
"commands.disk-destroy",
|
|
9503
9613
|
"commands.dangerous-word",
|
|
9614
|
+
"commands.node9-disarm",
|
|
9504
9615
|
"data.pipe-chain"
|
|
9505
9616
|
]);
|
|
9506
9617
|
var KNOB_GOVERNED = {
|
|
@@ -9512,7 +9623,8 @@ var KNOB_GOVERNED = {
|
|
|
9512
9623
|
"behavior.loops": ["off", "block"],
|
|
9513
9624
|
"behavior.prompt-injection": ["off", "log"],
|
|
9514
9625
|
"loading.skill-tamper": ["off", "log", "block"],
|
|
9515
|
-
"loading.malicious-package": ["off", "review", "block"]
|
|
9626
|
+
"loading.malicious-package": ["off", "review", "block"],
|
|
9627
|
+
"behavior.untrusted-content": ["off", "log", "review"]
|
|
9516
9628
|
};
|
|
9517
9629
|
function isKnobGoverned(id) {
|
|
9518
9630
|
return id in KNOB_GOVERNED;
|
|
@@ -9551,39 +9663,39 @@ var DEFAULT_EGRESS_ALLOWLIST = [
|
|
|
9551
9663
|
"deb.debian.org",
|
|
9552
9664
|
"*.ubuntu.com"
|
|
9553
9665
|
];
|
|
9554
|
-
function hostMatches(
|
|
9666
|
+
function hostMatches(host2, pattern) {
|
|
9555
9667
|
const p = pattern.trim().toLowerCase();
|
|
9556
9668
|
if (!p) return false;
|
|
9557
9669
|
if (p === "*") return true;
|
|
9558
|
-
const h = canonicalHost(
|
|
9670
|
+
const h = canonicalHost(host2);
|
|
9559
9671
|
if (p.startsWith("*.")) {
|
|
9560
9672
|
const suffix = canonicalHost(p.slice(2));
|
|
9561
9673
|
return h === suffix || h.endsWith("." + suffix);
|
|
9562
9674
|
}
|
|
9563
9675
|
return h === canonicalHost(p);
|
|
9564
9676
|
}
|
|
9565
|
-
function matchesAny(
|
|
9566
|
-
for (const p of patterns ?? []) if (hostMatches(
|
|
9677
|
+
function matchesAny(host2, patterns) {
|
|
9678
|
+
for (const p of patterns ?? []) if (hostMatches(host2, p)) return true;
|
|
9567
9679
|
return false;
|
|
9568
9680
|
}
|
|
9569
9681
|
var PRIVATE_HOST_SUFFIXES = [".local", ".internal", ".localhost"];
|
|
9570
|
-
function isUniqueLocalV6(
|
|
9571
|
-
const ip = normalizeIpLiteral(
|
|
9682
|
+
function isUniqueLocalV6(host2) {
|
|
9683
|
+
const ip = normalizeIpLiteral(host2);
|
|
9572
9684
|
if (!ip || !ip.includes(":")) return false;
|
|
9573
9685
|
const g = expandIpv6(ip);
|
|
9574
9686
|
return g !== null && (g[0] & 65024) === 64512;
|
|
9575
9687
|
}
|
|
9576
|
-
function isPrivateHost(
|
|
9577
|
-
const h =
|
|
9688
|
+
function isPrivateHost(host2) {
|
|
9689
|
+
const h = host2.trim().toLowerCase().replace(/\.$/, "");
|
|
9578
9690
|
const m = classifySsrf(h);
|
|
9579
9691
|
if (m) return m.kind === "address" && (m.tier === "private" || m.tier === "unspecified");
|
|
9580
9692
|
if (h === "localhost") return true;
|
|
9581
9693
|
if (PRIVATE_HOST_SUFFIXES.some((s) => h.endsWith(s))) return true;
|
|
9582
9694
|
return isUniqueLocalV6(h);
|
|
9583
9695
|
}
|
|
9584
|
-
function canonicalHost(
|
|
9585
|
-
const ip = normalizeIpLiteral(
|
|
9586
|
-
return ip ??
|
|
9696
|
+
function canonicalHost(host2) {
|
|
9697
|
+
const ip = normalizeIpLiteral(host2);
|
|
9698
|
+
return ip ?? host2.trim().toLowerCase().replace(/\.$/, "");
|
|
9587
9699
|
}
|
|
9588
9700
|
function evaluateEgress(dests, policy) {
|
|
9589
9701
|
if (!policy.enabled) return null;
|
|
@@ -9991,8 +10103,8 @@ function extractToolDestinations(toolName, args) {
|
|
|
9991
10103
|
const out = [];
|
|
9992
10104
|
for (const path of paths) {
|
|
9993
10105
|
for (const value of valuesAt(args, path)) {
|
|
9994
|
-
const
|
|
9995
|
-
if (
|
|
10106
|
+
const host2 = hostOf(value);
|
|
10107
|
+
if (host2) out.push({ host: host2, binary: toolName, raw: value });
|
|
9996
10108
|
}
|
|
9997
10109
|
}
|
|
9998
10110
|
return out;
|
|
@@ -10006,13 +10118,13 @@ function ssrfDestinationFloor(toolName, args, opts = {}) {
|
|
|
10006
10118
|
if (!paths) return null;
|
|
10007
10119
|
for (const path of paths) {
|
|
10008
10120
|
for (const value of valuesAt(args, path)) {
|
|
10009
|
-
const
|
|
10010
|
-
if (!
|
|
10011
|
-
const m = classifySsrf(
|
|
10121
|
+
const host2 = hostOf(value);
|
|
10122
|
+
if (!host2) continue;
|
|
10123
|
+
const m = classifySsrf(host2);
|
|
10012
10124
|
if (!m) continue;
|
|
10013
10125
|
if (isStrictGatedTier(m.tier) && !opts.ssrfStrict) continue;
|
|
10014
10126
|
if (m.overridable && ssrfExemptMatches(opts.ssrfAllow, m.normalized)) continue;
|
|
10015
|
-
return { ...m, argPath: path, host, reason: ssrfReason(m,
|
|
10127
|
+
return { ...m, argPath: path, host: host2, reason: ssrfReason(m, host2) };
|
|
10016
10128
|
}
|
|
10017
10129
|
}
|
|
10018
10130
|
return null;
|
|
@@ -10063,16 +10175,16 @@ function* encodedRegions(text, budget) {
|
|
|
10063
10175
|
/^[a-z][a-z0-9+.-]*:\/\/([^/?#]*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/i
|
|
10064
10176
|
);
|
|
10065
10177
|
if (!parts) continue;
|
|
10066
|
-
const
|
|
10178
|
+
const host2 = parts[1].slice(parts[1].lastIndexOf("@") + 1).replace(/:\d+$/, "");
|
|
10067
10179
|
const regions = [
|
|
10068
10180
|
parts[1],
|
|
10069
|
-
...
|
|
10181
|
+
...host2.split("."),
|
|
10070
10182
|
...parts[2].split("/"),
|
|
10071
10183
|
...(parts[3] ?? "").split("&"),
|
|
10072
10184
|
parts[4] ?? ""
|
|
10073
10185
|
];
|
|
10074
10186
|
for (const region of regions) if (region) yield [region, false];
|
|
10075
|
-
const labels =
|
|
10187
|
+
const labels = host2.split(".");
|
|
10076
10188
|
for (let start = 0; start < labels.length; start++) {
|
|
10077
10189
|
let joined = labels[start];
|
|
10078
10190
|
for (let end = start + 1; end < Math.min(labels.length, start + 8); end++) {
|
|
@@ -10340,7 +10452,7 @@ function pipeChainVerdict(command, isTrustedHost, highAction = "review") {
|
|
|
10340
10452
|
if (!pipeAnalysis.isPipeline) return null;
|
|
10341
10453
|
if (pipeAnalysis.risk !== "critical" && pipeAnalysis.risk !== "high") return null;
|
|
10342
10454
|
const sinks = pipeAnalysis.sinkTargets;
|
|
10343
|
-
const allTrusted = sinks.length > 0 && sinks.every((
|
|
10455
|
+
const allTrusted = sinks.length > 0 && sinks.every((host2) => isTrustedHost ? isTrustedHost(host2) : false);
|
|
10344
10456
|
if (pipeAnalysis.risk === "critical") {
|
|
10345
10457
|
if (allTrusted) {
|
|
10346
10458
|
return {
|
|
@@ -10818,6 +10930,638 @@ function isIgnoredTool(toolName, config) {
|
|
|
10818
10930
|
return matchesPattern(toolName, config.policy.ignoredTools);
|
|
10819
10931
|
}
|
|
10820
10932
|
|
|
10933
|
+
// src/exposure/destinations.ts
|
|
10934
|
+
var MAX_DESTINATIONS = 200;
|
|
10935
|
+
var MAX_SCAN_CHARS = 1e5;
|
|
10936
|
+
var EMAIL_RE = /[\p{L}\p{N}._%+-]+@[\p{L}\p{N}](?:[\p{L}\p{N}-]*[\p{L}\p{N}])?(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]*[\p{L}\p{N}])?)*\.\p{L}{2,}/gu;
|
|
10937
|
+
var URL_RE = /\b(?:[a-z][a-z0-9+.-]*:\/\/|www\.)[^\s<>"'`){}]+/gi;
|
|
10938
|
+
var IBAN_RE = /\b[A-Z]{2}\d{2}(?:[ -]?[A-Z0-9]{4}){2,7}(?:[ -]?[A-Z0-9]{1,4})?\b/g;
|
|
10939
|
+
var RECIPIENT_KEYS = /* @__PURE__ */ new Set([
|
|
10940
|
+
"to",
|
|
10941
|
+
"cc",
|
|
10942
|
+
"bcc",
|
|
10943
|
+
"recipient",
|
|
10944
|
+
"recipients",
|
|
10945
|
+
"email",
|
|
10946
|
+
"participants",
|
|
10947
|
+
"attendees",
|
|
10948
|
+
"destination",
|
|
10949
|
+
"iban",
|
|
10950
|
+
"account",
|
|
10951
|
+
// Where a request goes, when the value is a bare host or a scheme-less URL.
|
|
10952
|
+
"url",
|
|
10953
|
+
"uri",
|
|
10954
|
+
"host",
|
|
10955
|
+
"hostname",
|
|
10956
|
+
"endpoint",
|
|
10957
|
+
"server",
|
|
10958
|
+
"domain",
|
|
10959
|
+
"address",
|
|
10960
|
+
"webhook",
|
|
10961
|
+
"webhook_url",
|
|
10962
|
+
"callback",
|
|
10963
|
+
"callback_url",
|
|
10964
|
+
"target"
|
|
10965
|
+
]);
|
|
10966
|
+
function normalizeHost(raw) {
|
|
10967
|
+
let h = raw.trim().toLowerCase();
|
|
10968
|
+
if (h.startsWith("[") && h.endsWith("]")) h = h.slice(1, -1);
|
|
10969
|
+
if (!h || h === "localhost") return null;
|
|
10970
|
+
if (/^[0-9a-f:]+$/.test(h) && h.includes(":")) return h;
|
|
10971
|
+
if (!h.includes(".") || !/^[\p{L}\p{N}.-]+$/u.test(h)) return null;
|
|
10972
|
+
return h;
|
|
10973
|
+
}
|
|
10974
|
+
function hostOfUrl(value) {
|
|
10975
|
+
const v = value.replace(/[.,;:!?)\]}>'"`]+$/, "");
|
|
10976
|
+
try {
|
|
10977
|
+
const u = new URL(v.toLowerCase().startsWith("www.") ? `http://${v}` : v);
|
|
10978
|
+
return normalizeHost(u.hostname);
|
|
10979
|
+
} catch {
|
|
10980
|
+
return null;
|
|
10981
|
+
}
|
|
10982
|
+
}
|
|
10983
|
+
function addIbans(text, out) {
|
|
10984
|
+
for (const m of text.toUpperCase().matchAll(IBAN_RE)) {
|
|
10985
|
+
const compact = m[0].replace(/[ -]/g, "");
|
|
10986
|
+
if (validateIban(compact)) out.add(`iban:${compact}`);
|
|
10987
|
+
else if (/^[A-Z]{2}\d{2}[A-Z0-9]{11,30}$/.test(compact)) out.add(`account:${compact}`);
|
|
10988
|
+
if (out.size >= MAX_DESTINATIONS) return;
|
|
10989
|
+
}
|
|
10990
|
+
}
|
|
10991
|
+
function addEmails(text, out) {
|
|
10992
|
+
for (const m of text.matchAll(EMAIL_RE)) {
|
|
10993
|
+
out.add(`email:${m[0].toLowerCase()}`);
|
|
10994
|
+
if (out.size >= MAX_DESTINATIONS) return;
|
|
10995
|
+
}
|
|
10996
|
+
}
|
|
10997
|
+
function addUrlHosts(text, out) {
|
|
10998
|
+
for (const m of text.matchAll(URL_RE)) {
|
|
10999
|
+
const h = hostOfUrl(m[0]);
|
|
11000
|
+
if (h) out.add(`host:${h}`);
|
|
11001
|
+
if (out.size >= MAX_DESTINATIONS) return;
|
|
11002
|
+
}
|
|
11003
|
+
}
|
|
11004
|
+
function extractContentDestinations(text) {
|
|
11005
|
+
const out = /* @__PURE__ */ new Set();
|
|
11006
|
+
try {
|
|
11007
|
+
const t = text.length > MAX_SCAN_CHARS ? text.slice(0, MAX_SCAN_CHARS) : text;
|
|
11008
|
+
if (t.includes("@")) addEmails(t, out);
|
|
11009
|
+
if (out.size < MAX_DESTINATIONS) addUrlHosts(t, out);
|
|
11010
|
+
if (out.size < MAX_DESTINATIONS) addIbans(t, out);
|
|
11011
|
+
} catch {
|
|
11012
|
+
}
|
|
11013
|
+
return [...out];
|
|
11014
|
+
}
|
|
11015
|
+
function extractArgDestinations(args) {
|
|
11016
|
+
const out = /* @__PURE__ */ new Set();
|
|
11017
|
+
try {
|
|
11018
|
+
walk(args, void 0, out, 0);
|
|
11019
|
+
} catch {
|
|
11020
|
+
}
|
|
11021
|
+
return [...out];
|
|
11022
|
+
}
|
|
11023
|
+
function walk(value, key, out, depth) {
|
|
11024
|
+
if (out.size >= MAX_DESTINATIONS || depth > 12) return;
|
|
11025
|
+
if (typeof value === "string") {
|
|
11026
|
+
const s = value.length > MAX_SCAN_CHARS ? value.slice(0, MAX_SCAN_CHARS) : value;
|
|
11027
|
+
if (s.includes("@")) addEmails(s, out);
|
|
11028
|
+
addUrlHosts(s, out);
|
|
11029
|
+
addIbans(s, out);
|
|
11030
|
+
if (key && RECIPIENT_KEYS.has(key.toLowerCase()) && !/[\s@]/.test(s)) {
|
|
11031
|
+
const h = normalizeHost(
|
|
11032
|
+
s.replace(/^[a-z][a-z0-9+.-]*:\/\//i, "").replace(/^\/\//, "").split(/[/?#]/)[0].replace(/:\d+$/, "")
|
|
11033
|
+
);
|
|
11034
|
+
if (h && (h.includes(":") || /\.\p{L}{2,}$/u.test(h))) out.add(`host:${h}`);
|
|
11035
|
+
const acct = s.replace(/[ .-]/g, "").toUpperCase();
|
|
11036
|
+
if (/^[A-Z]{2}\d{2}[A-Z0-9]{11,30}$/.test(acct) && !validateIban(acct))
|
|
11037
|
+
out.add(`account:${acct}`);
|
|
11038
|
+
}
|
|
11039
|
+
return;
|
|
11040
|
+
}
|
|
11041
|
+
if (Array.isArray(value)) {
|
|
11042
|
+
for (const v of value) walk(v, key, out, depth + 1);
|
|
11043
|
+
return;
|
|
11044
|
+
}
|
|
11045
|
+
if (value && typeof value === "object") {
|
|
11046
|
+
for (const [k, v] of Object.entries(value))
|
|
11047
|
+
walk(v, k, out, depth + 1);
|
|
11048
|
+
}
|
|
11049
|
+
}
|
|
11050
|
+
function destinationDomain(dest) {
|
|
11051
|
+
if (!dest.startsWith("email:")) return null;
|
|
11052
|
+
const at = dest.lastIndexOf("@");
|
|
11053
|
+
return at > 0 ? dest.slice(at + 1) : null;
|
|
11054
|
+
}
|
|
11055
|
+
function destinationKind(dest) {
|
|
11056
|
+
const i = dest.indexOf(":");
|
|
11057
|
+
const k = i > 0 ? dest.slice(0, i) : "";
|
|
11058
|
+
return k === "email" || k === "host" || k === "iban" || k === "account" ? k : null;
|
|
11059
|
+
}
|
|
11060
|
+
function destinationValue(dest) {
|
|
11061
|
+
const i = dest.indexOf(":");
|
|
11062
|
+
return i > 0 ? dest.slice(i + 1) : dest;
|
|
11063
|
+
}
|
|
11064
|
+
function isLoopbackHost(host2) {
|
|
11065
|
+
let h = host2.trim().toLowerCase();
|
|
11066
|
+
if (h.startsWith("[") && h.endsWith("]")) h = h.slice(1, -1);
|
|
11067
|
+
return h === "localhost" || h.endsWith(".localhost") || /^127(?:\.\d{1,3}){3}$/.test(h) || h === "::1" || h === "0:0:0:0:0:0:0:1" || h === "0.0.0.0";
|
|
11068
|
+
}
|
|
11069
|
+
function gitRepoPath(url) {
|
|
11070
|
+
const u = url.trim();
|
|
11071
|
+
if (!u) return null;
|
|
11072
|
+
let host2;
|
|
11073
|
+
let p;
|
|
11074
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(u)) {
|
|
11075
|
+
try {
|
|
11076
|
+
const parsed = new URL(u);
|
|
11077
|
+
host2 = parsed.hostname.toLowerCase();
|
|
11078
|
+
p = decodeURIComponent(parsed.pathname);
|
|
11079
|
+
} catch {
|
|
11080
|
+
return null;
|
|
11081
|
+
}
|
|
11082
|
+
} else {
|
|
11083
|
+
const scp = /^(?:[^@/\s]+@)?([A-Za-z0-9.-]+):(?!\/\/)(.+)$/.exec(u);
|
|
11084
|
+
if (!scp || !scp[1].includes(".")) return null;
|
|
11085
|
+
host2 = scp[1].toLowerCase();
|
|
11086
|
+
p = scp[2];
|
|
11087
|
+
}
|
|
11088
|
+
let start = 0;
|
|
11089
|
+
let end = p.length;
|
|
11090
|
+
while (start < end && p[start] === "/") start++;
|
|
11091
|
+
while (end > start && p[end - 1] === "/") end--;
|
|
11092
|
+
const tail = p.slice(start, end).replace(/\.git$/i, "").toLowerCase();
|
|
11093
|
+
if (!host2 || !tail.includes("/")) return null;
|
|
11094
|
+
return `${host2}/${tail}`;
|
|
11095
|
+
}
|
|
11096
|
+
var DESTRUCTIVE_VERB_RE = /^(?:delete|remove|drop|destroy|purge|wipe|erase|transfer|pay|send_money|withdraw|change_password|update_password|reset_password|set_permission|grant|revoke|share)(?:_|$)/i;
|
|
11097
|
+
function isDestructiveToolName(bareTool) {
|
|
11098
|
+
return DESTRUCTIVE_VERB_RE.test(bareTool);
|
|
11099
|
+
}
|
|
11100
|
+
|
|
11101
|
+
// src/exposure/shell.ts
|
|
11102
|
+
import mvdanSh4 from "mvdan-sh";
|
|
11103
|
+
var { syntax: syntax4 } = mvdanSh4;
|
|
11104
|
+
var EMPTY = {
|
|
11105
|
+
fetches: false,
|
|
11106
|
+
sends: false,
|
|
11107
|
+
destinations: [],
|
|
11108
|
+
gitRemotes: [],
|
|
11109
|
+
repos: [],
|
|
11110
|
+
unresolved: false,
|
|
11111
|
+
fetchDestinations: [],
|
|
11112
|
+
fetchKinds: []
|
|
11113
|
+
};
|
|
11114
|
+
var CURL_SEND_FLAGS = /* @__PURE__ */ new Set([
|
|
11115
|
+
"-d",
|
|
11116
|
+
"--data",
|
|
11117
|
+
"--data-ascii",
|
|
11118
|
+
"--data-binary",
|
|
11119
|
+
"--data-raw",
|
|
11120
|
+
"--data-urlencode",
|
|
11121
|
+
"-F",
|
|
11122
|
+
"--form",
|
|
11123
|
+
"--form-string",
|
|
11124
|
+
"-T",
|
|
11125
|
+
"--upload-file",
|
|
11126
|
+
"--json"
|
|
11127
|
+
]);
|
|
11128
|
+
var WGET_SEND_FLAGS = /* @__PURE__ */ new Set(["--post-data", "--post-file", "--body-data", "--body-file"]);
|
|
11129
|
+
var IWR_SEND_FLAGS = /* @__PURE__ */ new Set(["-body", "-infile"]);
|
|
11130
|
+
var WRITE_METHODS = /* @__PURE__ */ new Set(["post", "put", "patch", "delete"]);
|
|
11131
|
+
var GH_READ = /* @__PURE__ */ new Set(["view", "list", "diff", "checks", "status", "download", "clone"]);
|
|
11132
|
+
var GH_WRITE = /* @__PURE__ */ new Set([
|
|
11133
|
+
"create",
|
|
11134
|
+
"comment",
|
|
11135
|
+
"edit",
|
|
11136
|
+
"close",
|
|
11137
|
+
"reopen",
|
|
11138
|
+
"merge",
|
|
11139
|
+
"review",
|
|
11140
|
+
"upload",
|
|
11141
|
+
"delete",
|
|
11142
|
+
"transfer",
|
|
11143
|
+
"pin",
|
|
11144
|
+
"lock",
|
|
11145
|
+
"ready",
|
|
11146
|
+
"set",
|
|
11147
|
+
"sync",
|
|
11148
|
+
"fork"
|
|
11149
|
+
]);
|
|
11150
|
+
var GH_HOSTNAME_FLAGS = /* @__PURE__ */ new Set(["--hostname", "-h", "-R", "--repo"]);
|
|
11151
|
+
var GH_REPO_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
11152
|
+
"--hostname",
|
|
11153
|
+
"-R",
|
|
11154
|
+
"--repo",
|
|
11155
|
+
"-d",
|
|
11156
|
+
"--description",
|
|
11157
|
+
"-h",
|
|
11158
|
+
"--homepage",
|
|
11159
|
+
"--visibility",
|
|
11160
|
+
"--default-branch",
|
|
11161
|
+
"--add-topic",
|
|
11162
|
+
"--remove-topic",
|
|
11163
|
+
"-p",
|
|
11164
|
+
"--template",
|
|
11165
|
+
"-s",
|
|
11166
|
+
"--source",
|
|
11167
|
+
"-b",
|
|
11168
|
+
"--branch",
|
|
11169
|
+
"-l",
|
|
11170
|
+
"--license",
|
|
11171
|
+
"-g",
|
|
11172
|
+
"--gitignore",
|
|
11173
|
+
"-t",
|
|
11174
|
+
"--team",
|
|
11175
|
+
"-r",
|
|
11176
|
+
"--remote",
|
|
11177
|
+
"--org"
|
|
11178
|
+
]);
|
|
11179
|
+
var GH_API_VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
11180
|
+
"--hostname",
|
|
11181
|
+
"-X",
|
|
11182
|
+
"--method",
|
|
11183
|
+
"-f",
|
|
11184
|
+
"--raw-field",
|
|
11185
|
+
"-F",
|
|
11186
|
+
"--field",
|
|
11187
|
+
"-H",
|
|
11188
|
+
"--header",
|
|
11189
|
+
"--input",
|
|
11190
|
+
"-q",
|
|
11191
|
+
"--jq",
|
|
11192
|
+
"-t",
|
|
11193
|
+
"--template",
|
|
11194
|
+
"--cache",
|
|
11195
|
+
"-p",
|
|
11196
|
+
"--preview"
|
|
11197
|
+
]);
|
|
11198
|
+
var GIT_FETCH = /* @__PURE__ */ new Set(["clone", "fetch", "pull", "ls-remote"]);
|
|
11199
|
+
var PUBLISH = {
|
|
11200
|
+
npm: { verbs: /* @__PURE__ */ new Set(["publish"]), registry: "registry.npmjs.org", flag: ["--registry"] },
|
|
11201
|
+
pnpm: { verbs: /* @__PURE__ */ new Set(["publish"]), registry: "registry.npmjs.org", flag: ["--registry"] },
|
|
11202
|
+
yarn: {
|
|
11203
|
+
verbs: /* @__PURE__ */ new Set(["publish", "npm"]),
|
|
11204
|
+
registry: "registry.npmjs.org",
|
|
11205
|
+
flag: ["--registry"]
|
|
11206
|
+
},
|
|
11207
|
+
twine: { verbs: /* @__PURE__ */ new Set(["upload"]), registry: "upload.pypi.org", flag: ["--repository-url"] },
|
|
11208
|
+
cargo: { verbs: /* @__PURE__ */ new Set(["publish"]), registry: "crates.io", flag: ["--registry", "--index"] },
|
|
11209
|
+
gem: { verbs: /* @__PURE__ */ new Set(["push"]), registry: "rubygems.org", flag: ["--host"] },
|
|
11210
|
+
docker: { verbs: /* @__PURE__ */ new Set(["push"]), registry: "docker.io" }
|
|
11211
|
+
};
|
|
11212
|
+
var SHELLS2 = /* @__PURE__ */ new Set(["sh", "bash", "zsh", "dash", "ksh"]);
|
|
11213
|
+
var OWN_HEADS = /* @__PURE__ */ new Set([...Object.keys(PUBLISH), "git", "gh"]);
|
|
11214
|
+
var MAX_DEPTH3 = 3;
|
|
11215
|
+
function host(token) {
|
|
11216
|
+
if (!token) return null;
|
|
11217
|
+
const h = parseDestHost(token);
|
|
11218
|
+
return h ? `host:${h}` : null;
|
|
11219
|
+
}
|
|
11220
|
+
var CWD_CHANGERS = /* @__PURE__ */ new Set(["cd", "pushd", "popd"]);
|
|
11221
|
+
function ghRepoArg(v, defaultHost) {
|
|
11222
|
+
if (/:\/\/|@/.test(v)) {
|
|
11223
|
+
const r = gitRepoPath(v);
|
|
11224
|
+
if (r) return { host: r.split("/")[0], repo: r };
|
|
11225
|
+
}
|
|
11226
|
+
const parts = v.toLowerCase().replace(/\.git$/, "").split("/").filter(Boolean);
|
|
11227
|
+
if (parts.length === 3) return { host: parts[0], repo: parts.join("/") };
|
|
11228
|
+
if (parts.length === 2) return { host: defaultHost, repo: `${defaultHost}/${parts.join("/")}` };
|
|
11229
|
+
return { host: defaultHost, repo: `${defaultHost}/*` };
|
|
11230
|
+
}
|
|
11231
|
+
function ghApiRepo(endpoint, ghHost) {
|
|
11232
|
+
if (endpoint === null) return `${ghHost}/*`;
|
|
11233
|
+
const e = endpoint.replace(/^https?:\/\/[^/]+\//i, "").replace(/^\/+/, "");
|
|
11234
|
+
const m = /^repos\/([^/]+)\/([^/?#]+)/i.exec(e);
|
|
11235
|
+
if (!m) return `${ghHost}/*`;
|
|
11236
|
+
if (m[1] === "{owner}" && m[2] === "{repo}") return void 0;
|
|
11237
|
+
return `${ghHost}/${m[1].toLowerCase()}/${m[2].toLowerCase()}`;
|
|
11238
|
+
}
|
|
11239
|
+
function sendToGitUrl(url, out) {
|
|
11240
|
+
out.sends = true;
|
|
11241
|
+
const h = typeof url === "string" ? host(url) : null;
|
|
11242
|
+
if (!url || !h) {
|
|
11243
|
+
out.unresolved = true;
|
|
11244
|
+
return;
|
|
11245
|
+
}
|
|
11246
|
+
out.destinations.push(h);
|
|
11247
|
+
const r = gitRepoPath(url);
|
|
11248
|
+
if (r) out.repos.push(r);
|
|
11249
|
+
}
|
|
11250
|
+
function callWords(call) {
|
|
11251
|
+
const raw = call.Args || [];
|
|
11252
|
+
if (raw.length === 0) return null;
|
|
11253
|
+
const words = raw.map((a) => resolveWordLiteral(a));
|
|
11254
|
+
const prefixes = raw.map((a) => resolveWordPrefix(a).prefix);
|
|
11255
|
+
const first = (words[0] || "").toLowerCase().split("/").pop() ?? "";
|
|
11256
|
+
const at = OWN_HEADS.has(first) ? 0 : unwrapCommandHead(words);
|
|
11257
|
+
const head = (words[at] || "").toLowerCase().split("/").pop() ?? "";
|
|
11258
|
+
if (!head) return null;
|
|
11259
|
+
const assigns = call.Assigns || [];
|
|
11260
|
+
const env = [
|
|
11261
|
+
...assigns.map((a) => String(a?.Name?.Value ?? "")),
|
|
11262
|
+
...words.slice(0, at).map((w) => w === null ? "" : /^([A-Za-z_][A-Za-z0-9_]*)=/.exec(w)?.[1] ?? "")
|
|
11263
|
+
].filter(Boolean);
|
|
11264
|
+
return { head, args: words.slice(at + 1), prefixes: prefixes.slice(at + 1), env };
|
|
11265
|
+
}
|
|
11266
|
+
function flagValue(args, names) {
|
|
11267
|
+
for (let i = 0; i < args.length; i++) {
|
|
11268
|
+
const w = args[i];
|
|
11269
|
+
if (w === null) continue;
|
|
11270
|
+
for (const n of names) {
|
|
11271
|
+
if (w === n && typeof args[i + 1] === "string") return args[i + 1];
|
|
11272
|
+
if (w.startsWith(`${n}=`)) return w.slice(n.length + 1);
|
|
11273
|
+
}
|
|
11274
|
+
}
|
|
11275
|
+
return null;
|
|
11276
|
+
}
|
|
11277
|
+
function positionals(args, valueFlags) {
|
|
11278
|
+
const out = [];
|
|
11279
|
+
for (let i = 0; i < args.length; i++) {
|
|
11280
|
+
const w = args[i];
|
|
11281
|
+
if (w === null) {
|
|
11282
|
+
out.push(null);
|
|
11283
|
+
continue;
|
|
11284
|
+
}
|
|
11285
|
+
if (w === "--") {
|
|
11286
|
+
out.push(...args.slice(i + 1));
|
|
11287
|
+
break;
|
|
11288
|
+
}
|
|
11289
|
+
if (w.startsWith("-")) {
|
|
11290
|
+
if (!w.includes("=") && valueFlags.has(w)) i++;
|
|
11291
|
+
continue;
|
|
11292
|
+
}
|
|
11293
|
+
out.push(w);
|
|
11294
|
+
}
|
|
11295
|
+
return out;
|
|
11296
|
+
}
|
|
11297
|
+
function classifyCall(head, args, prefixes, env, state, out) {
|
|
11298
|
+
const lower2 = args.map((a) => a === null ? null : a.toLowerCase());
|
|
11299
|
+
switch (head) {
|
|
11300
|
+
case "curl":
|
|
11301
|
+
case "wget":
|
|
11302
|
+
case "iwr":
|
|
11303
|
+
case "invoke-webrequest":
|
|
11304
|
+
case "irm":
|
|
11305
|
+
case "invoke-restmethod": {
|
|
11306
|
+
const binary = head === "wget" ? "wget" : "curl";
|
|
11307
|
+
const sendFlags = head === "wget" ? WGET_SEND_FLAGS : head === "curl" ? CURL_SEND_FLAGS : IWR_SEND_FLAGS;
|
|
11308
|
+
let sends = false;
|
|
11309
|
+
for (let i = 0; i < args.length; i++) {
|
|
11310
|
+
const w = args[i];
|
|
11311
|
+
if (w === null) continue;
|
|
11312
|
+
const name = (head === "curl" || head === "wget" ? w : w.toLowerCase()).split("=")[0];
|
|
11313
|
+
if (sendFlags.has(name)) sends = true;
|
|
11314
|
+
const next = lower2[i + 1];
|
|
11315
|
+
if ((name === "-X" || name === "--request" || name === "-method") && next) {
|
|
11316
|
+
if (WRITE_METHODS.has(next)) sends = true;
|
|
11317
|
+
}
|
|
11318
|
+
if (/^(?:--request=|-X)(POST|PUT|PATCH|DELETE)$/i.test(w)) sends = true;
|
|
11319
|
+
if (name === "--method" && next && WRITE_METHODS.has(next)) sends = true;
|
|
11320
|
+
}
|
|
11321
|
+
const withPrefixes = args.map(
|
|
11322
|
+
(a, i) => a === null && /^[a-z][a-z0-9+.-]*:\/\//i.test(prefixes[i] ?? "") ? prefixes[i] : a
|
|
11323
|
+
);
|
|
11324
|
+
const dests = destTokensForBinary(binary, withPrefixes).map((t) => host(t)).filter((h) => h !== null);
|
|
11325
|
+
out.fetches = true;
|
|
11326
|
+
out.fetchKinds.push(head);
|
|
11327
|
+
out.fetchDestinations.push(...dests);
|
|
11328
|
+
if (sends) {
|
|
11329
|
+
out.sends = true;
|
|
11330
|
+
out.destinations.push(...dests);
|
|
11331
|
+
}
|
|
11332
|
+
return;
|
|
11333
|
+
}
|
|
11334
|
+
case "scp":
|
|
11335
|
+
case "rsync": {
|
|
11336
|
+
const pos = positionals(args, VALUE_FLAGS[head] ?? /* @__PURE__ */ new Set()).filter(
|
|
11337
|
+
(p) => p !== null
|
|
11338
|
+
);
|
|
11339
|
+
if (pos.length < 2) return;
|
|
11340
|
+
const remote = (p) => /^[a-z][a-z0-9+.-]*:\/\//i.test(p) || /^[^/]*[^/:]:[^/]/.test(p) || p.includes("@");
|
|
11341
|
+
const target = pos[pos.length - 1];
|
|
11342
|
+
const sources = pos.slice(0, -1);
|
|
11343
|
+
if (remote(target)) {
|
|
11344
|
+
out.sends = true;
|
|
11345
|
+
const h = host(target);
|
|
11346
|
+
if (h) out.destinations.push(h);
|
|
11347
|
+
}
|
|
11348
|
+
if (sources.some(remote)) {
|
|
11349
|
+
out.fetches = true;
|
|
11350
|
+
out.fetchKinds.push(head);
|
|
11351
|
+
for (const src of sources.filter(remote)) {
|
|
11352
|
+
const h = host(src);
|
|
11353
|
+
if (h) out.fetchDestinations.push(h);
|
|
11354
|
+
}
|
|
11355
|
+
}
|
|
11356
|
+
return;
|
|
11357
|
+
}
|
|
11358
|
+
case "nc":
|
|
11359
|
+
case "ncat":
|
|
11360
|
+
case "netcat":
|
|
11361
|
+
case "ssh": {
|
|
11362
|
+
out.fetches = true;
|
|
11363
|
+
out.sends = true;
|
|
11364
|
+
out.fetchKinds.push(head);
|
|
11365
|
+
for (const t of destTokensForBinary(head, args)) {
|
|
11366
|
+
const h = host(t);
|
|
11367
|
+
if (h) {
|
|
11368
|
+
out.destinations.push(h);
|
|
11369
|
+
out.fetchDestinations.push(h);
|
|
11370
|
+
}
|
|
11371
|
+
}
|
|
11372
|
+
return;
|
|
11373
|
+
}
|
|
11374
|
+
case "gh": {
|
|
11375
|
+
const pos = positionals(args, GH_HOSTNAME_FLAGS);
|
|
11376
|
+
const group = pos[0] ?? null;
|
|
11377
|
+
const verb = pos[1] ?? null;
|
|
11378
|
+
const hn = flagValue(args, ["--hostname"]);
|
|
11379
|
+
let dest = host(hn ?? "github.com") ?? "host:github.com";
|
|
11380
|
+
const ghHost = dest.slice("host:".length);
|
|
11381
|
+
const envRepo = env.some((n) => n === "GH_REPO" || n === "GH_HOST");
|
|
11382
|
+
if (group === "api") {
|
|
11383
|
+
const method = (flagValue(args, ["-X", "--method"]) ?? "get").toLowerCase();
|
|
11384
|
+
const hasBody = args.some(
|
|
11385
|
+
(w) => w !== null && /^(-f|--raw-field|-F|--field|--input)(=|$)/.test(w)
|
|
11386
|
+
);
|
|
11387
|
+
if (WRITE_METHODS.has(method) || hasBody) {
|
|
11388
|
+
out.sends = true;
|
|
11389
|
+
out.destinations.push(dest);
|
|
11390
|
+
const endpoint = positionals(args, GH_API_VALUE_FLAGS)[1] ?? null;
|
|
11391
|
+
const repo = ghApiRepo(endpoint, ghHost);
|
|
11392
|
+
if (repo !== void 0) out.repos.push(repo);
|
|
11393
|
+
else if (envRepo) out.repos.push(`${ghHost}/*`);
|
|
11394
|
+
} else {
|
|
11395
|
+
out.fetches = true;
|
|
11396
|
+
out.fetchKinds.push("gh api");
|
|
11397
|
+
out.fetchDestinations.push(dest);
|
|
11398
|
+
}
|
|
11399
|
+
return;
|
|
11400
|
+
}
|
|
11401
|
+
if (group === null || verb === null) return;
|
|
11402
|
+
if (GH_WRITE.has(verb)) {
|
|
11403
|
+
out.sends = true;
|
|
11404
|
+
const rIdx = args.findIndex((w) => w === "-R" || w === "--repo");
|
|
11405
|
+
const rEq = args.find((w) => w !== null && /^(-R|--repo)=/.test(w));
|
|
11406
|
+
const rVal = rEq !== void 0 && rEq !== null ? rEq.slice(rEq.indexOf("=") + 1) : rIdx >= 0 ? args[rIdx + 1] : void 0;
|
|
11407
|
+
let repo;
|
|
11408
|
+
if (rIdx >= 0 || rEq !== void 0) {
|
|
11409
|
+
if (typeof rVal === "string") {
|
|
11410
|
+
const named = ghRepoArg(rVal, ghHost);
|
|
11411
|
+
repo = named.repo;
|
|
11412
|
+
if (named.host !== ghHost) dest = `host:${named.host}`;
|
|
11413
|
+
} else repo = `${ghHost}/*`;
|
|
11414
|
+
} else if (group === "gist" || group === "repo" && (verb === "create" || verb === "fork")) {
|
|
11415
|
+
repo = `${ghHost}/*`;
|
|
11416
|
+
} else if (group === "repo" && verb !== "rename") {
|
|
11417
|
+
const operand = positionals(args, GH_REPO_VALUE_FLAGS)[2];
|
|
11418
|
+
if (operand === null) repo = `${ghHost}/*`;
|
|
11419
|
+
else if (operand !== void 0) repo = ghRepoArg(operand, ghHost).repo;
|
|
11420
|
+
else if (envRepo) repo = `${ghHost}/*`;
|
|
11421
|
+
} else if (envRepo) {
|
|
11422
|
+
repo = `${ghHost}/*`;
|
|
11423
|
+
}
|
|
11424
|
+
out.destinations.push(dest);
|
|
11425
|
+
if (repo !== void 0) out.repos.push(repo);
|
|
11426
|
+
} else if (GH_READ.has(verb)) {
|
|
11427
|
+
out.fetches = true;
|
|
11428
|
+
out.fetchKinds.push(`gh ${group}`);
|
|
11429
|
+
out.fetchDestinations.push(dest);
|
|
11430
|
+
}
|
|
11431
|
+
return;
|
|
11432
|
+
}
|
|
11433
|
+
case "git": {
|
|
11434
|
+
const pos = positionals(args, /* @__PURE__ */ new Set(["-C", "-c", "--git-dir", "--work-tree"]));
|
|
11435
|
+
const verb = pos[0];
|
|
11436
|
+
if (verb === null || verb === void 0) return;
|
|
11437
|
+
for (let i = 0; i < args.length; i++) {
|
|
11438
|
+
if (args[i] !== "-c") continue;
|
|
11439
|
+
const v = args[i + 1];
|
|
11440
|
+
if (v === null || v === void 0) {
|
|
11441
|
+
if (verb === "push") out.unresolved = true;
|
|
11442
|
+
continue;
|
|
11443
|
+
}
|
|
11444
|
+
const m = /^remote\.[^=]+\.(?:push)?url=(.*)$/i.exec(v);
|
|
11445
|
+
if (m) sendToGitUrl(m[1], out);
|
|
11446
|
+
}
|
|
11447
|
+
if (verb === "remote") {
|
|
11448
|
+
const rp = positionals(args, /* @__PURE__ */ new Set(["-C", "-c", "--git-dir", "--work-tree", "-t", "-m"]));
|
|
11449
|
+
const sub = rp[1];
|
|
11450
|
+
if (sub === "add" || sub === "set-url") {
|
|
11451
|
+
const url = rp.slice(2).filter((p) => p !== "--push" && p !== "--add")[1];
|
|
11452
|
+
sendToGitUrl(url, out);
|
|
11453
|
+
}
|
|
11454
|
+
return;
|
|
11455
|
+
}
|
|
11456
|
+
if (verb === "config") {
|
|
11457
|
+
const reads = args.some(
|
|
11458
|
+
(w) => w !== null && /^--(get|get-all|get-regexp|unset|unset-all|list|get-urlmatch)$/.test(w)
|
|
11459
|
+
);
|
|
11460
|
+
const k = pos.findIndex((p) => p !== null && /^remote\..+\.(?:push)?url$/i.test(p));
|
|
11461
|
+
if (k >= 0 && k + 1 < pos.length && !reads) sendToGitUrl(pos[k + 1], out);
|
|
11462
|
+
return;
|
|
11463
|
+
}
|
|
11464
|
+
if (GIT_FETCH.has(verb)) {
|
|
11465
|
+
out.fetches = true;
|
|
11466
|
+
out.fetchKinds.push(`git ${verb}`);
|
|
11467
|
+
for (const p of pos.slice(1)) {
|
|
11468
|
+
const h = p !== null && /:\/\/|@/.test(p) ? host(p) : null;
|
|
11469
|
+
if (h) out.fetchDestinations.push(h);
|
|
11470
|
+
}
|
|
11471
|
+
return;
|
|
11472
|
+
}
|
|
11473
|
+
if (verb === "push") {
|
|
11474
|
+
if (pos.length > 1 && pos[1] === null) {
|
|
11475
|
+
out.sends = true;
|
|
11476
|
+
out.unresolved = true;
|
|
11477
|
+
return;
|
|
11478
|
+
}
|
|
11479
|
+
const target = flagValue(args, ["--repo"]) ?? pos.slice(1).find((p) => p !== null && !p.startsWith("-")) ?? null;
|
|
11480
|
+
if (target !== null && (/:\/\/|@/.test(target) || /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+:/.test(target))) {
|
|
11481
|
+
sendToGitUrl(target, out);
|
|
11482
|
+
return;
|
|
11483
|
+
}
|
|
11484
|
+
if (target !== null && /^[./~]|\//.test(target)) return;
|
|
11485
|
+
out.sends = true;
|
|
11486
|
+
const elsewhere = state.cwdChanged || args.some((w) => w !== null && /^(-C|--git-dir|--work-tree)(=|$)/.test(w)) || env.some((n) => n === "GIT_DIR" || n === "GIT_WORK_TREE" || n === "GIT_CONFIG");
|
|
11487
|
+
if (elsewhere) out.unresolved = true;
|
|
11488
|
+
else out.gitRemotes.push(target ?? "");
|
|
11489
|
+
}
|
|
11490
|
+
return;
|
|
11491
|
+
}
|
|
11492
|
+
default: {
|
|
11493
|
+
const pub = PUBLISH[head];
|
|
11494
|
+
if (!pub) return;
|
|
11495
|
+
const pos = positionals(args, new Set(pub.flag ?? []));
|
|
11496
|
+
const verb = pos[0];
|
|
11497
|
+
if (verb === null || verb === void 0 || !pub.verbs.has(verb)) return;
|
|
11498
|
+
if (head === "yarn" && verb === "npm" && pos[1] !== "publish") return;
|
|
11499
|
+
out.sends = true;
|
|
11500
|
+
const named = pub.flag ? flagValue(args, pub.flag) : null;
|
|
11501
|
+
const h = named ? host(named) : null;
|
|
11502
|
+
if (named && !h) return;
|
|
11503
|
+
if (head === "docker") {
|
|
11504
|
+
const image = pos[1];
|
|
11505
|
+
const first = image?.split("/")[0] ?? "";
|
|
11506
|
+
const reg = first.includes(".") || first.includes(":") ? host(first) : null;
|
|
11507
|
+
out.destinations.push(reg ?? "host:docker.io");
|
|
11508
|
+
return;
|
|
11509
|
+
}
|
|
11510
|
+
out.destinations.push(h ?? `host:${pub.registry}`);
|
|
11511
|
+
}
|
|
11512
|
+
}
|
|
11513
|
+
}
|
|
11514
|
+
function walkCalls(command, out, depth, state) {
|
|
11515
|
+
const f = parseShared(command);
|
|
11516
|
+
if (typeof f === "symbol" || !f) return;
|
|
11517
|
+
syntax4.Walk(f, (node) => {
|
|
11518
|
+
if (!node) return false;
|
|
11519
|
+
const type = syntax4.NodeType(node);
|
|
11520
|
+
if (type === "DeclClause") {
|
|
11521
|
+
for (const a of node.Args || []) if (a?.Name?.Value) state.env.add(a.Name.Value);
|
|
11522
|
+
return true;
|
|
11523
|
+
}
|
|
11524
|
+
if (type !== "CallExpr") return true;
|
|
11525
|
+
const call = node;
|
|
11526
|
+
if ((call.Args || []).length === 0) {
|
|
11527
|
+
for (const a of call.Assigns || []) if (a?.Name?.Value) state.env.add(a.Name.Value);
|
|
11528
|
+
return true;
|
|
11529
|
+
}
|
|
11530
|
+
const c = callWords(node);
|
|
11531
|
+
if (!c) return true;
|
|
11532
|
+
if (SHELLS2.has(c.head) && depth < MAX_DEPTH3) {
|
|
11533
|
+
const i = c.args.findIndex((w) => w === "-c" || w === "-lc" || w === "-ec");
|
|
11534
|
+
const payload = i >= 0 ? c.args[i + 1] : null;
|
|
11535
|
+
if (typeof payload === "string") walkCalls(payload, out, depth + 1, state);
|
|
11536
|
+
return true;
|
|
11537
|
+
}
|
|
11538
|
+
if (CWD_CHANGERS.has(c.head)) state.cwdChanged = true;
|
|
11539
|
+
classifyCall(c.head, c.args, c.prefixes, [...c.env, ...state.env], state, out);
|
|
11540
|
+
return true;
|
|
11541
|
+
});
|
|
11542
|
+
}
|
|
11543
|
+
function classifyShellExposure(command) {
|
|
11544
|
+
const out = {
|
|
11545
|
+
...EMPTY,
|
|
11546
|
+
destinations: [],
|
|
11547
|
+
gitRemotes: [],
|
|
11548
|
+
repos: [],
|
|
11549
|
+
fetchDestinations: [],
|
|
11550
|
+
fetchKinds: []
|
|
11551
|
+
};
|
|
11552
|
+
try {
|
|
11553
|
+
walkCalls(command, out, 0, { cwdChanged: false, env: /* @__PURE__ */ new Set() });
|
|
11554
|
+
} catch {
|
|
11555
|
+
return { ...EMPTY };
|
|
11556
|
+
}
|
|
11557
|
+
out.destinations = [...new Set(out.destinations)];
|
|
11558
|
+
out.fetchDestinations = [...new Set(out.fetchDestinations)];
|
|
11559
|
+
out.gitRemotes = [...new Set(out.gitRemotes)];
|
|
11560
|
+
out.repos = [...new Set(out.repos)];
|
|
11561
|
+
out.fetchKinds = [...new Set(out.fetchKinds)];
|
|
11562
|
+
return out;
|
|
11563
|
+
}
|
|
11564
|
+
|
|
10821
11565
|
// src/utils/safe-text.ts
|
|
10822
11566
|
var TERMINAL_ESCAPE_RE = /\x1b\[[0-9;?]*[A-Za-z]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-_]|[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g;
|
|
10823
11567
|
var CONTROL_CHAR_RE = /[\x00-\x1F\x7F]/g;
|
|
@@ -11218,7 +11962,7 @@ function detectArgsPii(args) {
|
|
|
11218
11962
|
// src/dlp/canary.ts
|
|
11219
11963
|
var CANARY_MIN_LENGTH = 16;
|
|
11220
11964
|
var MAX_TEXT = 1e5;
|
|
11221
|
-
var
|
|
11965
|
+
var MAX_DEPTH4 = 6;
|
|
11222
11966
|
var MAX_JSON_PARSE = 1e4;
|
|
11223
11967
|
var URL_DEPTH = 4;
|
|
11224
11968
|
var B64_DEPTH = 3;
|
|
@@ -11341,8 +12085,8 @@ function matchCanaryArgs(args, values) {
|
|
|
11341
12085
|
if (values.length === 0) return null;
|
|
11342
12086
|
const needles = prepare(values);
|
|
11343
12087
|
if (needles.length === 0) return null;
|
|
11344
|
-
const
|
|
11345
|
-
if (depth >
|
|
12088
|
+
const walk2 = (v, depth, fieldPath) => {
|
|
12089
|
+
if (depth > MAX_DEPTH4) return null;
|
|
11346
12090
|
if (typeof v === "string") {
|
|
11347
12091
|
const hit = matchPrepared(v, needles);
|
|
11348
12092
|
if (hit) return { id: hit.v.id, view: hit.view, fieldPath, retired: Boolean(hit.v.retired) };
|
|
@@ -11350,31 +12094,31 @@ function matchCanaryArgs(args, values) {
|
|
|
11350
12094
|
const trimmed = v.trim();
|
|
11351
12095
|
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
11352
12096
|
try {
|
|
11353
|
-
return
|
|
12097
|
+
return walk2(JSON.parse(v), depth + 1, fieldPath);
|
|
11354
12098
|
} catch {
|
|
11355
12099
|
}
|
|
11356
12100
|
}
|
|
11357
12101
|
}
|
|
11358
12102
|
return null;
|
|
11359
12103
|
}
|
|
11360
|
-
if (typeof v === "number" && Number.isFinite(v)) return
|
|
12104
|
+
if (typeof v === "number" && Number.isFinite(v)) return walk2(String(v), depth, fieldPath);
|
|
11361
12105
|
if (Array.isArray(v)) {
|
|
11362
12106
|
for (let i = 0; i < v.length; i++) {
|
|
11363
|
-
const h =
|
|
12107
|
+
const h = walk2(v[i], depth + 1, `${fieldPath}[${i}]`);
|
|
11364
12108
|
if (h) return h;
|
|
11365
12109
|
}
|
|
11366
12110
|
return null;
|
|
11367
12111
|
}
|
|
11368
12112
|
if (v && typeof v === "object") {
|
|
11369
12113
|
for (const [k, child] of Object.entries(v)) {
|
|
11370
|
-
const h =
|
|
12114
|
+
const h = walk2(child, depth + 1, fieldPath ? `${fieldPath}.${k}` : k);
|
|
11371
12115
|
if (h) return h;
|
|
11372
12116
|
}
|
|
11373
12117
|
}
|
|
11374
12118
|
return null;
|
|
11375
12119
|
};
|
|
11376
12120
|
try {
|
|
11377
|
-
return
|
|
12121
|
+
return walk2(args, 0, "");
|
|
11378
12122
|
} catch (e) {
|
|
11379
12123
|
console.error(
|
|
11380
12124
|
"[node9 engine] canary args walk failed:",
|
|
@@ -11387,7 +12131,7 @@ function matchCanaryArgs(args, values) {
|
|
|
11387
12131
|
// src/scan/canonical.ts
|
|
11388
12132
|
var LONG_OUTPUT_THRESHOLD_BYTES = 100 * 1024;
|
|
11389
12133
|
var CANONICAL_EXTRACTOR_VERSION = "canonical-v25";
|
|
11390
|
-
var CANONICAL_EXTRACTOR_HASH = "
|
|
12134
|
+
var CANONICAL_EXTRACTOR_HASH = "48ef4af5dd89198d";
|
|
11391
12135
|
var DEDUPE_PREVIEW_LEN = 120;
|
|
11392
12136
|
function extractCanonicalFindings(call, ctx) {
|
|
11393
12137
|
const out = [];
|
|
@@ -11757,6 +12501,8 @@ function* stringValues(obj, depth = 0) {
|
|
|
11757
12501
|
// src/index.ts
|
|
11758
12502
|
var ENGINE_VERSION = "1.4.0";
|
|
11759
12503
|
export {
|
|
12504
|
+
AGENT_INSTRUCTION_DIRS,
|
|
12505
|
+
AGENT_INSTRUCTION_FILES,
|
|
11760
12506
|
ARGUMENT_SCAN_LIMITS,
|
|
11761
12507
|
AST_FS_REGEX_RULES,
|
|
11762
12508
|
BASH_TOOL_NAMES,
|
|
@@ -11789,6 +12535,7 @@ export {
|
|
|
11789
12535
|
LOOP_THRESHOLD_FOR_WASTE,
|
|
11790
12536
|
MAP_GOVERNED,
|
|
11791
12537
|
MAX_BLAST_PATH,
|
|
12538
|
+
MAX_DESTINATIONS,
|
|
11792
12539
|
NET_BINARIES,
|
|
11793
12540
|
PATTERN_VERB_NAMES,
|
|
11794
12541
|
PRIVILEGE_ESCALATION_RE,
|
|
@@ -11815,6 +12562,7 @@ export {
|
|
|
11815
12562
|
classifyAuditEntry,
|
|
11816
12563
|
classifyRuleSeverity,
|
|
11817
12564
|
classifyScanSignal,
|
|
12565
|
+
classifyShellExposure,
|
|
11818
12566
|
classifySsrf,
|
|
11819
12567
|
collectFileAccesses,
|
|
11820
12568
|
computeAgentDeviceScore,
|
|
@@ -11826,6 +12574,9 @@ export {
|
|
|
11826
12574
|
decodeEmbeddedBase64,
|
|
11827
12575
|
decodeEmbeddedHex,
|
|
11828
12576
|
dedupeCanonicalFindings,
|
|
12577
|
+
destinationDomain,
|
|
12578
|
+
destinationKind,
|
|
12579
|
+
destinationValue,
|
|
11829
12580
|
detectArgsPii,
|
|
11830
12581
|
detectDangerousEval,
|
|
11831
12582
|
detectDangerousShellExec,
|
|
@@ -11837,7 +12588,9 @@ export {
|
|
|
11837
12588
|
evaluateProtectedFileAccess,
|
|
11838
12589
|
evaluateSmartConditions,
|
|
11839
12590
|
extractAllSshHosts,
|
|
12591
|
+
extractArgDestinations,
|
|
11840
12592
|
extractCanonicalFindings,
|
|
12593
|
+
extractContentDestinations,
|
|
11841
12594
|
extractNetworkTargets,
|
|
11842
12595
|
extractPackageInstalls,
|
|
11843
12596
|
extractPositionalArgs,
|
|
@@ -11851,14 +12604,19 @@ export {
|
|
|
11851
12604
|
getCheck,
|
|
11852
12605
|
getCompiledRegex,
|
|
11853
12606
|
getNestedValue,
|
|
12607
|
+
gitRepoPath,
|
|
11854
12608
|
hostMatches,
|
|
11855
12609
|
incompleteFileVerdict,
|
|
11856
12610
|
inspectArgumentSecrets,
|
|
12611
|
+
isAgentInstructionPath,
|
|
11857
12612
|
isBashTool,
|
|
12613
|
+
isDestructiveToolName,
|
|
11858
12614
|
isIgnoredTool,
|
|
12615
|
+
isInside,
|
|
11859
12616
|
isKnobGoverned,
|
|
11860
12617
|
isLegacySystemPath,
|
|
11861
12618
|
isLockedCheck,
|
|
12619
|
+
isLoopbackHost,
|
|
11862
12620
|
isPasswordHashPath,
|
|
11863
12621
|
isPrivateHost,
|
|
11864
12622
|
isProtectedHomePath,
|