@node9/policy-engine 2.50.1 → 2.52.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.js CHANGED
@@ -157,6 +157,7 @@ __export(src_exports, {
157
157
  gitInvocations: () => gitInvocations,
158
158
  gitRepoPath: () => gitRepoPath,
159
159
  hashDestination: () => hashDestination,
160
+ holdsSendsWithoutDaemon: () => holdsSendsWithoutDaemon,
160
161
  hostMatches: () => hostMatches,
161
162
  incompleteFileVerdict: () => incompleteFileVerdict,
162
163
  inlineExecDescription: () => inlineExecDescription,
@@ -2384,15 +2385,15 @@ function ssrfExemptMatches(entries, normalized) {
2384
2385
  continue;
2385
2386
  }
2386
2387
  if (!target) continue;
2387
- const base2 = bitsOf(normalizeIpLiteral(entry.slice(0, slash)) ?? "");
2388
+ const base3 = bitsOf(normalizeIpLiteral(entry.slice(0, slash)) ?? "");
2388
2389
  const prefixText = entry.slice(slash + 1);
2389
2390
  const prefix = /^\d+$/.test(prefixText) ? Number(prefixText) : NaN;
2390
- if (!base2 || !Number.isInteger(prefix) || prefix < 0 || // A v4 range never matches a v6 address, and the reverse: the widths
2391
+ if (!base3 || !Number.isInteger(prefix) || prefix < 0 || // A v4 range never matches a v6 address, and the reverse: the widths
2391
2392
  // differ, so `0.0.0.0/0` does not release `::1`.
2392
- base2.length !== target.length || prefix > base2.length) {
2393
+ base3.length !== target.length || prefix > base3.length) {
2393
2394
  continue;
2394
2395
  }
2395
- if (base2.slice(0, prefix) === target.slice(0, prefix)) return true;
2396
+ if (base3.slice(0, prefix) === target.slice(0, prefix)) return true;
2396
2397
  }
2397
2398
  return false;
2398
2399
  }
@@ -2689,7 +2690,7 @@ var CHECK_TEXT = {
2689
2690
  advice: "Fixed at Review for now."
2690
2691
  },
2691
2692
  "commands.node9-disarm": {
2692
- 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.",
2693
+ plain: "The agent switches node9 off or weakens it: stops or kills the daemon, stops its service, uninstalls node9, changes files in ~/.node9, clears a session flag, trusts an address, pauses the gate, weakens a shield.",
2693
2694
  example: "After reading a web page, the agent runs node9 session-exposure clear --all",
2694
2695
  advice: "Keep Review: these are your commands to run. Block if the agent should never touch node9."
2695
2696
  },
@@ -2742,6 +2743,10 @@ function reviewsEveryAgentFileWrite(mode) {
2742
2743
  const level = levelOf(mode);
2743
2744
  return level === "strict" || level === "block-all";
2744
2745
  }
2746
+ function holdsSendsWithoutDaemon(mode) {
2747
+ const level = levelOf(mode);
2748
+ return level === "strict" || level === "block-all";
2749
+ }
2745
2750
  function isBlockAll(mode) {
2746
2751
  return levelOf(mode) === "block-all";
2747
2752
  }
@@ -3111,7 +3116,7 @@ var PRODUCT_CHECKS = [
3111
3116
  group: "commands",
3112
3117
  owasp: "ASI10",
3113
3118
  title: "node9 disarmed from the shell",
3114
- catches: "a node9 command that clears a session flag, trusts a destination, pauses the gate or weakens a shield, run by the agent",
3119
+ catches: "the agent stopping or killing the node9 daemon, stopping its service, uninstalling node9, changing files in ~/.node9, or running a node9 command that clears a session flag, trusts a destination, pauses the gate or weakens a shield",
3115
3120
  values: ALL,
3116
3121
  defaultValue: "review",
3117
3122
  legacy: ["review-node9-disarm"]
@@ -5677,9 +5682,15 @@ function detectDangerousShellExec(command) {
5677
5682
  if (f === PARSE_FAIL) return null;
5678
5683
  let result = null;
5679
5684
  const assigned = assignedNames(f);
5680
- walk(f, (node) => {
5685
+ const known = plainlyNamedPrograms(f);
5686
+ const calledByName = literallyCalledFunctions(f);
5687
+ const bodies = [];
5688
+ const inBody = (pos) => bodies.some(([a, b]) => pos >= a && pos < b);
5689
+ walkWithCalls(f, (node) => {
5681
5690
  if (!node || result === "block") return false;
5682
5691
  const n = node;
5692
+ if (n.kind === "FuncDecl" && n.Body && callDepth === 0 && calledByName.has(n.Name?.Value))
5693
+ bodies.push([n.Body.pos, n.Body.end]);
5683
5694
  if (n.kind === "BinaryCmd" && n.Y && !listOps().has(n.Op)) {
5684
5695
  const call = n.Y.Cmd;
5685
5696
  if (call && call.kind === "CallExpr") {
@@ -5703,7 +5714,8 @@ function detectDangerousShellExec(command) {
5703
5714
  );
5704
5715
  const head = unwrapCommandHead(headWords, false, true);
5705
5716
  const lookup = headWords[0]?.toLowerCase() === "command" && headWords.slice(1).some((w) => w === "-v" || w === "-V");
5706
- if (!lookup && (opaqueExecutable(args[0], assigned) || opaqueExecutable(args[head], assigned)))
5717
+ const unboundBody = callDepth === 0 && inBody(n.pos ?? -1);
5718
+ if (!lookup && !unboundBody && (opaqueExecutable(args[0], assigned, known) || opaqueExecutable(args[head], assigned, known)))
5707
5719
  result = "review";
5708
5720
  const firstParts = args[0].Parts || [];
5709
5721
  if (firstParts.length !== 1 || firstParts[0].kind !== "Lit") return true;
@@ -5747,6 +5759,7 @@ function lookupSubstitution(part) {
5747
5759
  if (words.length === 3 && words[0] === "type" && words[1] === "-p") return words[2];
5748
5760
  return null;
5749
5761
  }
5762
+ var EMPTY_NAMES = /* @__PURE__ */ new Set();
5750
5763
  var VARIABLE_READERS = /* @__PURE__ */ new Set([
5751
5764
  "read",
5752
5765
  "mapfile",
@@ -5776,11 +5789,106 @@ function assignedNames(f) {
5776
5789
  });
5777
5790
  return names;
5778
5791
  }
5779
- function executableParts(word, assigned, quoted = false) {
5792
+ function literallyCalledFunctions(f) {
5793
+ const declared = /* @__PURE__ */ new Set();
5794
+ const called = /* @__PURE__ */ new Set();
5795
+ walk(f, (node) => {
5796
+ if (!node) return false;
5797
+ if (node.kind === "FuncDecl" && node.Name?.Value) declared.add(node.Name.Value);
5798
+ if (node.kind === "CallExpr") {
5799
+ const head = resolveWordLiteral(node.Args?.[0]);
5800
+ if (head) called.add(head);
5801
+ }
5802
+ return true;
5803
+ });
5804
+ return new Set([...declared].filter((name) => called.has(name)));
5805
+ }
5806
+ var PLAIN_PROGRAM_NAME = /^[A-Za-z_][\w.+-]*$/;
5807
+ function plainlyNamedPrograms(f) {
5808
+ const values = /* @__PURE__ */ new Map();
5809
+ const arrays = /* @__PURE__ */ new Set();
5810
+ const give = (name, value) => {
5811
+ if (value === null || !PLAIN_PROGRAM_NAME.test(value)) {
5812
+ values.set(name, null);
5813
+ return;
5814
+ }
5815
+ const cur = values.get(name);
5816
+ if (cur === null) return;
5817
+ if (cur === void 0) values.set(name, /* @__PURE__ */ new Set([value]));
5818
+ else cur.add(value);
5819
+ };
5820
+ const literalOnly = (w) => {
5821
+ const parts = w?.Parts ?? [];
5822
+ if (parts.length !== 1) return null;
5823
+ const p = parts[0];
5824
+ if (p.kind === "Lit") return p.Value ?? null;
5825
+ if (p.kind === "ParamExp" && expansionName(p) === "FUNCNAME") return "FUNCNAME";
5826
+ if (p.kind === "SglQuoted" && !p.Dollar) return p.Value ?? null;
5827
+ if (p.kind === "DblQuoted") {
5828
+ const inner = p.Parts ?? [];
5829
+ return inner.length === 1 && inner[0].kind === "Lit" ? inner[0].Value ?? null : null;
5830
+ }
5831
+ return null;
5832
+ };
5833
+ let ifsTouched = false;
5834
+ walk(f, (node) => {
5835
+ if (!node) return false;
5836
+ const kind = node.kind;
5837
+ if (kind === "FuncDecl" && node.Name?.Value) give(node.Name.Value, node.Name.Value);
5838
+ if (kind === "Assign" && node.Name?.Value) {
5839
+ const name = node.Name.Value;
5840
+ if (name === "IFS") ifsTouched = true;
5841
+ if (node.Append) values.set(name, null);
5842
+ else if (node.Array) {
5843
+ arrays.add(name);
5844
+ for (const el of node.Array.Elems ?? []) give(name, literalOnly(el.Value));
5845
+ } else if (node.Index) {
5846
+ arrays.add(name);
5847
+ give(name, node.Value ? literalOnly(node.Value) : null);
5848
+ } else give(name, node.Value ? literalOnly(node.Value) : null);
5849
+ }
5850
+ if (kind === "ForClause" && node.Loop?.Name?.Value) values.set(node.Loop.Name.Value, null);
5851
+ if (kind === "CallExpr") {
5852
+ const words = (node.Args ?? []).map((a) => resolveWordLiteral(a));
5853
+ if (VARIABLE_READERS.has(words[0] ?? "")) {
5854
+ for (const w of words.slice(1)) if (w && /^[A-Za-z_]\w*$/.test(w)) values.set(w, null);
5855
+ }
5856
+ }
5857
+ return true;
5858
+ });
5859
+ if (ifsTouched) return /* @__PURE__ */ new Set();
5860
+ const functions = /* @__PURE__ */ new Set();
5861
+ walk(f, (node) => {
5862
+ if (node && node.kind === "FuncDecl" && node.Name?.Value) functions.add(node.Name.Value);
5863
+ return true;
5864
+ });
5865
+ const callable = (v) => functions.has(v) || v === "FUNCNAME" || v === "true" || v === "false" || v === ":";
5866
+ for (const [name, vals] of values) {
5867
+ if (vals && ![...vals].every(callable)) values.set(name, null);
5868
+ }
5869
+ const known = /* @__PURE__ */ new Set();
5870
+ for (const [name, vals] of values)
5871
+ if (vals && (vals.size === 1 || arrays.has(name) && vals.size > 0)) known.add(name);
5872
+ return known;
5873
+ }
5874
+ function expansionName(part) {
5875
+ if (part.kind !== "ParamExp") return null;
5876
+ if (part.Excl || part.Length || part.Width || part.Slice || part.Repl || part.Exp) return null;
5877
+ return part.Param?.Value ?? null;
5878
+ }
5879
+ function executableParts(word, assigned, quoted = false, known = EMPTY_NAMES) {
5780
5880
  return (word?.Parts ?? []).flatMap((part) => {
5781
5881
  const kind = part.kind;
5782
- if (kind === "DblQuoted") return executableParts(part, assigned, true);
5882
+ if (kind === "DblQuoted") return executableParts(part, assigned, true, known);
5783
5883
  if (kind === "Lit") return [{ kind: "Lit", value: part.Value ?? "", quoted }];
5884
+ const name = expansionName(part);
5885
+ if (name !== null && (known.has(name) || name === "FUNCNAME"))
5886
+ return [{ kind: "Lit", value: name, quoted }];
5887
+ if (name !== null) {
5888
+ const bound = recordedExpansion(name === "@" || name === "*" ? "1" : name);
5889
+ if (typeof bound === "string" && PLAIN_PROGRAM_NAME.test(bound))
5890
+ return [{ kind: "Lit", value: bound, quoted }];
5891
+ }
5784
5892
  if (kind === "SglQuoted")
5785
5893
  return [{ kind: part.Dollar ? "Dynamic" : "Lit", value: part.Value ?? "", quoted: true }];
5786
5894
  if (kind === "ParamExp" && isDefaultExpansion(part) && !assigned.has(part.Param?.Value)) {
@@ -5788,14 +5896,14 @@ function executableParts(word, assigned, quoted = false) {
5788
5896
  if (fallback !== null) return [{ kind: "Lit", value: fallback, quoted }];
5789
5897
  }
5790
5898
  if (kind === "CmdSubst") {
5791
- const name = lookupSubstitution(part);
5792
- if (name !== null) return [{ kind: "Lit", value: name, quoted }];
5899
+ const name2 = lookupSubstitution(part);
5900
+ if (name2 !== null) return [{ kind: "Lit", value: name2, quoted }];
5793
5901
  }
5794
5902
  return [{ kind: "Dynamic", value: "", quoted }];
5795
5903
  });
5796
5904
  }
5797
- function opaqueExecutable(word, assigned) {
5798
- const parts = executableParts(word, assigned);
5905
+ function opaqueExecutable(word, assigned, known = EMPTY_NAMES) {
5906
+ const parts = executableParts(word, assigned, false, known);
5799
5907
  let lastSlash = -1;
5800
5908
  parts.forEach((p, i) => {
5801
5909
  if (p.kind === "Lit" && p.value.includes("/")) lastSlash = i;
@@ -6605,6 +6713,9 @@ var _listOps = null;
6605
6713
  function isListOp(op) {
6606
6714
  return listOps().has(op);
6607
6715
  }
6716
+ function isPipeOp(op) {
6717
+ return pipeOps().has(op);
6718
+ }
6608
6719
  function listOps() {
6609
6720
  if (_listOps) return _listOps;
6610
6721
  _listOps = new Set(
@@ -6880,6 +6991,33 @@ function isProtectedCodePath(p) {
6880
6991
  if (matchSensitivePath(p) !== null) return true;
6881
6992
  return SYSTEM_AUTH_FILES.includes(p) || SYSTEM_AUTH_DIRS.some((d) => p === d || p.startsWith(d + "/"));
6882
6993
  }
6994
+ function isJailedCodePath(literal, jailPaths) {
6995
+ const value = trimTrailingSlashes(literal.replace(/\\/g, "/"));
6996
+ if (!value) return false;
6997
+ for (const raw of jailPaths) {
6998
+ const jail = trimTrailingSlashes(raw.trim().replace(/\\/g, "/"));
6999
+ if (!jail) continue;
7000
+ const home = homeTail(jail);
7001
+ if (home === null) {
7002
+ if (value === jail || value.startsWith(jail + "/")) return true;
7003
+ continue;
7004
+ }
7005
+ if (!home) continue;
7006
+ const tail = homeTail(value);
7007
+ if (tail !== null && (tail === home || tail.startsWith(home + "/"))) return true;
7008
+ }
7009
+ return false;
7010
+ }
7011
+ function trimTrailingSlashes(s) {
7012
+ let end = s.length;
7013
+ while (end > 0 && s.charCodeAt(end - 1) === 47) end--;
7014
+ return s.slice(0, end);
7015
+ }
7016
+ function homeTail(p) {
7017
+ const m = /^(?:~|\$\{?HOME\}?|\/home\/[^/]+|\/Users\/[^/]+|\/root)(?:\/(.*))?$/.exec(p);
7018
+ if (!m) return null;
7019
+ return m[1] ?? "";
7020
+ }
6883
7021
  function inlineExecDescription(r) {
6884
7022
  const lead = r ? `The AI is running code directly from the command line: ${inlineExecReason(r).replace(/^This/, "this")}.` : "The AI is running code directly from the command line.";
6885
7023
  return `${lead} Review the full script below before allowing it to execute.`;
@@ -6888,7 +7026,8 @@ function inlineExecReason(r) {
6888
7026
  const who = r.interp ? `This inline ${r.interp} code` : "This inline code";
6889
7027
  return r.evidence ? `${who} ${r.what} (${r.evidence})` : `${who} ${r.what}`;
6890
7028
  }
6891
- function inlineExecReview(command) {
7029
+ function inlineExecReview(command, jailPaths = []) {
7030
+ const isProtected = jailPaths.length === 0 ? isProtectedCodePath : (p) => isProtectedCodePath(p) || isJailedCodePath(p, jailPaths);
6892
7031
  const calls = inlineExecCalls(command);
6893
7032
  if (calls === PARSE_FAIL) {
6894
7033
  return INLINE_EXEC_FALLBACK.test(command) ? { outcome: "unreadable", interp: "", what: "could not be parsed" } : null;
@@ -6911,7 +7050,7 @@ function inlineExecReview(command) {
6911
7050
  what: `is ${call.interp} code, which node9 does not read`
6912
7051
  };
6913
7052
  } else {
6914
- const judged = judgeInlineCode(language, code, isProtectedCodePath);
7053
+ const judged = judgeInlineCode(language, code, isProtected);
6915
7054
  if (judged) finding = { ...judged, interp: call.interp };
6916
7055
  }
6917
7056
  if (finding?.outcome === "dangerous") return finding;
@@ -7270,6 +7409,13 @@ function recordTopLevelStmt(stmt) {
7270
7409
  if (t === "DeclClause") return ASSIGNMENT_HEADS.has(stmt.Cmd.Variant?.Value ?? "");
7271
7410
  return (stmt.Cmd.Args || []).length === 0 && (stmt.Cmd.Assigns || []).length > 0;
7272
7411
  }
7412
+ var ARRAY_MARK = "array";
7413
+ var ARRAY_SEP = "";
7414
+ function arrayElements(value) {
7415
+ if (typeof value !== "string" || !value.startsWith(ARRAY_MARK)) return null;
7416
+ const body = value.slice(ARRAY_MARK.length);
7417
+ return body === "" ? [] : body.split(ARRAY_SEP);
7418
+ }
7273
7419
  function recordAssignments(n, at) {
7274
7420
  if (!assignmentTable) return;
7275
7421
  const t = n.kind;
@@ -7283,7 +7429,19 @@ function recordAssignments(n, at) {
7283
7429
  } else return;
7284
7430
  for (const a of assigns) {
7285
7431
  const name = a?.Name?.Value;
7286
- if (!name || !a.Value || a.Append) continue;
7432
+ if (!name) continue;
7433
+ if (a.Array) {
7434
+ const elems = (a.Array.Elems || []).map(
7435
+ (e) => e?.Index ? null : resolveWordLiteral(e?.Value)
7436
+ );
7437
+ const literal = elems.every((v) => v !== null);
7438
+ assignmentTable.set(name, {
7439
+ value: literal && !a.Append ? ARRAY_MARK + elems.join(ARRAY_SEP) : null,
7440
+ at
7441
+ });
7442
+ continue;
7443
+ }
7444
+ if (!a.Value || a.Append) continue;
7287
7445
  assignmentTable.set(name, { value: resolveWordLiteral(a.Value), at });
7288
7446
  }
7289
7447
  }
@@ -7294,7 +7452,33 @@ function resolveTrivialSubst(part) {
7294
7452
  const st = stmts[0];
7295
7453
  if ((st.Redirs || []).length > 0 || st.Negated || st.Background) return void 0;
7296
7454
  const cmd = st.Cmd;
7297
- if (!cmd || cmd.kind !== "CallExpr") return void 0;
7455
+ if (!cmd) return void 0;
7456
+ if (cmd.kind === "BinaryCmd" && pipeOps().has(cmd.Op)) {
7457
+ const left = cmd.X?.Cmd;
7458
+ const right = cmd.Y?.Cmd;
7459
+ if (!left || !right || left.kind !== "CallExpr" || right.kind !== "CallExpr") return void 0;
7460
+ if ((cmd.X.Redirs || []).length > 0 || (cmd.Y.Redirs || []).length > 0) return void 0;
7461
+ const input = trivialCallOutput(left);
7462
+ if (input === void 0) return void 0;
7463
+ const filter = (right.Args || []).map((a) => resolveWordLiteral(a));
7464
+ if (filter.some((w) => w === null)) return void 0;
7465
+ const f = baseWord(filter[0]);
7466
+ const flags = filter.slice(1);
7467
+ if (f === "base64" && flags.length === 1 && /^(-d|-D|--decode)$/.test(flags[0])) {
7468
+ try {
7469
+ const out = Buffer.from(input, "base64").toString("utf8");
7470
+ return /^[\x20-\x7e]*$/.test(out) ? out : void 0;
7471
+ } catch {
7472
+ return void 0;
7473
+ }
7474
+ }
7475
+ if (f === "rev" && flags.length === 0) return [...input].reverse().join("");
7476
+ return void 0;
7477
+ }
7478
+ if (cmd.kind !== "CallExpr") return void 0;
7479
+ return trivialCallOutput(cmd);
7480
+ }
7481
+ function trivialCallOutput(cmd) {
7298
7482
  if ((cmd.Assigns || []).length > 0) return void 0;
7299
7483
  const words = (cmd.Args || []).map((a) => resolveWordLiteral(a));
7300
7484
  if (words.length === 0 || words.some((w) => w === null)) return void 0;
@@ -7306,9 +7490,16 @@ function resolveTrivialSubst(part) {
7306
7490
  return rest.slice(i).join(" ");
7307
7491
  }
7308
7492
  if (head === "printf") {
7493
+ if (rest.length === 1 && /^(?:\\(?:[0-7]{1,3}|x[0-9A-Fa-f]{1,2}))+$/.test(rest[0])) {
7494
+ return rest[0].replace(
7495
+ /\\(?:x([0-9A-Fa-f]{1,2})|([0-7]{1,3}))/g,
7496
+ (_, hex, oct) => String.fromCharCode(hex ? parseInt(hex, 16) : parseInt(oct, 8))
7497
+ );
7498
+ }
7309
7499
  if (rest.length !== 2) return void 0;
7310
- if (!/^%s(\\n)?$/.test(rest[0])) return void 0;
7311
- return rest[1];
7500
+ const m = /^([^%]*)%s([^%]*?)(\\n)?$/.exec(rest[0]);
7501
+ if (!m) return void 0;
7502
+ return m[1] + rest[1] + m[2];
7312
7503
  }
7313
7504
  return void 0;
7314
7505
  }
@@ -7322,11 +7513,28 @@ function isPlainParam(p) {
7322
7513
  if (p.kind !== "ParamExp") return false;
7323
7514
  return !(p.Excl || p.Length || p.Width || p.Index || p.Slice || p.Repl || p.Exp);
7324
7515
  }
7516
+ function indexedParam(p) {
7517
+ if (p.kind !== "ParamExp" || !p.Index) return null;
7518
+ if (p.Excl || p.Length || p.Width || p.Slice || p.Repl || p.Exp) return null;
7519
+ const index = resolveWordLiteral(p.Index);
7520
+ const name = p.Param?.Value;
7521
+ return name && index !== null ? { name, index } : null;
7522
+ }
7325
7523
  function expandPlainParam(p) {
7326
7524
  if (!assignmentTable) return void 0;
7525
+ const indexed = indexedParam(p);
7526
+ if (indexed) {
7527
+ const elems = arrayElements(recordedExpansion(indexed.name));
7528
+ if (elems === null) return void 0;
7529
+ if (indexed.index === "@" || indexed.index === "*") return elems.join(" ");
7530
+ return /^\d+$/.test(indexed.index) ? elems[Number(indexed.index)] ?? null : null;
7531
+ }
7327
7532
  if (!isPlainParam(p)) return void 0;
7328
7533
  const recorded = recordedExpansion(p.Param?.Value);
7329
- if (recorded !== void 0) return recorded;
7534
+ if (recorded !== void 0) {
7535
+ const elems = arrayElements(recorded);
7536
+ return elems === null ? recorded : elems[0] ?? "";
7537
+ }
7330
7538
  return HOME_VARIABLES.has(p.Param?.Value) ? "~" : void 0;
7331
7539
  }
7332
7540
  var MAX_CALL_DEPTH2 = 4;
@@ -7732,8 +7940,8 @@ function analyzeFsOperation(command) {
7732
7940
  }
7733
7941
  var stripDotSlash = (p) => p.replace(/^\.\//, "");
7734
7942
  function isSensitiveCleanupName(p) {
7735
- const base2 = p.replace(/^.*[\\/]/, "");
7736
- return /^\.env(\.|$)/i.test(base2) || /(?:^|[\\/])\.(?:ssh|aws|gnupg|git)(?:[\\/]|$)/i.test(p) || /\.(?:pem|key|p12|pfx|crt)$/i.test(base2) || /^\.?(?:netrc|npmrc|pgpass|htpasswd)$/i.test(base2) || /^id_(?:rsa|dsa|ecdsa|ed25519)/i.test(base2) || /credential/i.test(p) || /secret/i.test(base2);
7943
+ const base3 = p.replace(/^.*[\\/]/, "");
7944
+ return /^\.env(\.|$)/i.test(base3) || /(?:^|[\\/])\.(?:ssh|aws|gnupg|git)(?:[\\/]|$)/i.test(p) || /\.(?:pem|key|p12|pfx|crt)$/i.test(base3) || /^\.?(?:netrc|npmrc|pgpass|htpasswd)$/i.test(base3) || /^id_(?:rsa|dsa|ecdsa|ed25519)/i.test(base3) || /credential/i.test(p) || /secret/i.test(base3);
7737
7945
  }
7738
7946
  function isWaivableCleanupTarget(p) {
7739
7947
  if (/^[/~]/.test(p) || /^\$/.test(p)) return false;
@@ -9124,6 +9332,21 @@ function hits(access, paths, directories, context) {
9124
9332
  }
9125
9333
  return false;
9126
9334
  }
9335
+ function hitsNode9Dir(access, dirs, context) {
9336
+ const home = context.homeDirs?.[0] ?? "~";
9337
+ if (access.glob) {
9338
+ const pattern = normalizeFilePath(access.glob, access.cwd ?? context.cwd, home);
9339
+ const magic = pattern.search(/[*?[{]/);
9340
+ const literal = magic < 0 ? pattern : pattern.slice(0, pattern.lastIndexOf("/", magic));
9341
+ return dirs.some((d) => within(literal, d));
9342
+ }
9343
+ const candidates = access.candidates ?? [
9344
+ normalizeFilePath(access.path, access.cwd ?? context.cwd, home)
9345
+ ];
9346
+ return candidates.some(
9347
+ (p) => dirs.some((d) => within(p, d)) || access.recursive === true && dirs.some((d) => within(d, p))
9348
+ );
9349
+ }
9127
9350
  var exempt = (p) => SYSTEM_DIRS_EXEMPT.some((d) => within(p, d));
9128
9351
  function hitsSystemDir(access, context, dirs = SYSTEM_DIRS) {
9129
9352
  const home = context.homeDirs?.[0] ?? "~";
@@ -9166,6 +9389,7 @@ function evaluateProtectedFileAccess(accesses, context, settings) {
9166
9389
  const consider = (result) => {
9167
9390
  if (!best || RANK[result.decision] > RANK[best.decision]) best = result;
9168
9391
  };
9392
+ const node9Dirs = homes.map((home) => `${home.replace(/\/$/, "")}/.node9`);
9169
9393
  for (const access of accesses) {
9170
9394
  const mutation = access.operation !== "read";
9171
9395
  let kind;
@@ -9194,6 +9418,10 @@ function evaluateProtectedFileAccess(accesses, context, settings) {
9194
9418
  "files.system-dirs",
9195
9419
  "review-root-home-read",
9196
9420
  "Reading the root account's home requires approval"
9421
+ ] : mutation && hitsNode9Dir(access, node9Dirs, context) ? [
9422
+ "commands.node9-disarm",
9423
+ "review-node9-disarm",
9424
+ "Changing node9's own files requires approval"
9197
9425
  ] : null;
9198
9426
  } catch {
9199
9427
  consider(incompleteFileVerdict(access.operation));
@@ -12198,9 +12426,9 @@ function validateBelgianNationalNumber(raw) {
12198
12426
  if (!/^\d{11}$/.test(d)) return false;
12199
12427
  const month = Number(d.slice(2, 4)) % 20;
12200
12428
  if (month !== 0 && !plausibleDate(String(month).padStart(2, "0"), d.slice(4, 6))) return false;
12201
- const base2 = Number(d.slice(0, 9));
12429
+ const base3 = Number(d.slice(0, 9));
12202
12430
  const check = Number(d.slice(9, 11));
12203
- return 97 - base2 % 97 === check || 97 - (2e9 + base2) % 97 === check;
12431
+ return 97 - base3 % 97 === check || 97 - (2e9 + base3) % 97 === check;
12204
12432
  }
12205
12433
  function validateCuit(raw) {
12206
12434
  const d = raw.replace(/-/g, "");
@@ -13764,7 +13992,22 @@ var GitWalk = class {
13764
13992
  found;
13765
13993
  /** Aliases defined earlier in this command: name -> value (null = dynamic). */
13766
13994
  aliases = /* @__PURE__ */ new Map();
13995
+ /** node9Firewall#385: variables assigned a tree-top word (`scope="$PWD"`,
13996
+ * `root=$(git rev-parse --show-toplevel)`, `DIR=$(pwd)`), so the
13997
+ * variable reads as the top where it is used. */
13998
+ treeTopVars = /* @__PURE__ */ new Set();
13999
+ /** node9Firewall#385 (c): a string a script builds with `+=` from
14000
+ * literals (`mode=--ha; mode+=rd`). The jail's table does not follow an
14001
+ * append (JAIL-14a); the git rules read the built word, since a flag
14002
+ * spelled in two halves is still that flag. name -> value, null once a
14003
+ * half is unknown. */
14004
+ appended = /* @__PURE__ */ new Map();
13767
14005
  payloads = /* @__PURE__ */ new Set();
14006
+ /** node9Firewall#385 (a): the text this command writes to each path
14007
+ * (`cat > /tmp/x.sh <<'SH' ... SH`, `echo '...' > f`, `>>` appends), so
14008
+ * a later statement that runs the path (`bash f`, `sh f`, `./f`) is
14009
+ * judged on what it runs. null once a write to the path is unknown. */
14010
+ written = /* @__PURE__ */ new Map();
13768
14011
  /** `for NAME in a b c`: the literal items, or null when one is dynamic. */
13769
14012
  loopVars = /* @__PURE__ */ new Map();
13770
14013
  /** Walk one command string. Returns false when it did not parse. */
@@ -13783,6 +14026,25 @@ var GitWalk = class {
13783
14026
  const type = n.kind;
13784
14027
  if (type === "Stmt") {
13785
14028
  this.visitHeredocShell(n, depth);
14029
+ this.visitPipeline(n, depth);
14030
+ this.visitHookWrite(n);
14031
+ this.recordScriptWrite(n);
14032
+ this.visitWrittenScript(n, depth);
14033
+ return true;
14034
+ }
14035
+ if (type === "Assign" && n.Name?.Value && n.Value) {
14036
+ const name = n.Name.Value;
14037
+ if (n.Append) {
14038
+ const prev = this.appended.has(name) ? this.appended.get(name) : resolveWordLiteral(n.Value) === null ? null : void 0;
14039
+ const base3 = prev === void 0 ? recordedExpansion(name) : prev;
14040
+ const piece = resolveWordLiteral(n.Value);
14041
+ this.appended.set(name, typeof base3 === "string" && piece !== null ? base3 + piece : null);
14042
+ this.treeTopVars.delete(name);
14043
+ return true;
14044
+ }
14045
+ this.appended.delete(name);
14046
+ if (treeTopWord(n.Value, this.treeTopVars)) this.treeTopVars.add(name);
14047
+ else this.treeTopVars.delete(name);
13786
14048
  return true;
13787
14049
  }
13788
14050
  if (type === "ForClause") {
@@ -13811,13 +14073,13 @@ var GitWalk = class {
13811
14073
  const param = plainParamName(rawArgs[loopArg]);
13812
14074
  for (const item of this.loopVars.get(param.name)) {
13813
14075
  const words2 = rawArgs.flatMap(
13814
- (a, i) => i === loopArg ? param.quoted ? [item] : splitFields(item) : resolveGitWords(a)
14076
+ (a, i) => i === loopArg ? param.quoted ? [item] : splitFields(item) : resolveGitWords(a, this.treeTopVars, this.appended)
13815
14077
  );
13816
14078
  this.visitWords(words2, new Map(prefixEnv), depth, false);
13817
14079
  }
13818
14080
  return true;
13819
14081
  }
13820
- const words = rawArgs.flatMap((a) => resolveGitWords(a));
14082
+ const words = rawArgs.flatMap((a) => resolveGitWords(a, this.treeTopVars, this.appended));
13821
14083
  this.visitWords(words, prefixEnv, depth, false);
13822
14084
  return true;
13823
14085
  }
@@ -13842,6 +14104,23 @@ var GitWalk = class {
13842
14104
  if (f) this.found(f);
13843
14105
  return;
13844
14106
  }
14107
+ if (headWord === "rm" || headWord === "unlink") {
14108
+ if (words.slice(head + 1).some((w) => w !== null && isLiveHookFile(w)))
14109
+ this.found(hooksBypassed(shownOf(words)));
14110
+ return;
14111
+ }
14112
+ if (headWord === "mv") {
14113
+ const operands2 = words.slice(head + 1).filter((w) => w === null || !w.startsWith("-"));
14114
+ const src = operands2[0];
14115
+ if (typeof src === "string" && isLiveHookFile(src)) this.found(hooksBypassed(shownOf(words)));
14116
+ return;
14117
+ }
14118
+ if (headWord === "perl") {
14119
+ const code = words.slice(head + 1).find((w) => w !== null && /\brename\b/.test(w));
14120
+ const m = code ? /rename\s*\(?\s*q[qw]?\s*[(\[{<'"]([^)\]}>'"]+)/.exec(code) : null;
14121
+ if (m && isLiveHookFile(m[1])) this.found(hooksBypassed(shownOf(words)));
14122
+ return;
14123
+ }
13845
14124
  if (depth < MAX_PAYLOAD_DEPTH2) {
13846
14125
  const payload = literalShellPayload(words, baseWord(words[0]));
13847
14126
  if (payload !== null) this.runPayload(payload, depth);
@@ -13852,6 +14131,127 @@ var GitWalk = class {
13852
14131
  this.payloads.add(payload);
13853
14132
  this.run(payload, depth + 1);
13854
14133
  }
14134
+ /**
14135
+ * node9Firewall#385: a pipeline whose last stage reads its pathspec from
14136
+ * stdin (`git add --pathspec-from-file=-`) or runs git over the names it
14137
+ * is fed (`xargs -0 git add --`), with a producer that is one literal
14138
+ * (`git rev-parse --show-toplevel`, `printf '%s\0' .`): the literal is
14139
+ * the operand, and the call is judged with it.
14140
+ */
14141
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14142
+ visitPipeline(stmt, depth) {
14143
+ const cmd = stmt.Cmd;
14144
+ if (!cmd || cmd.kind !== "BinaryCmd" || !isPipeOp(cmd.Op)) return;
14145
+ const stages = [];
14146
+ let cur = cmd;
14147
+ while (cur?.kind === "BinaryCmd" && isPipeOp(cur.Op)) {
14148
+ stages.unshift(cur.Y);
14149
+ const left = cur.X;
14150
+ if (left?.Cmd?.kind === "BinaryCmd" && isPipeOp(left.Cmd.Op)) cur = left.Cmd;
14151
+ else {
14152
+ stages.unshift(left);
14153
+ break;
14154
+ }
14155
+ }
14156
+ if (stages.length < 2) return;
14157
+ const producer = stages[stages.length - 2]?.Cmd;
14158
+ const consumer = stages[stages.length - 1]?.Cmd;
14159
+ if (!producer || !consumer || producer.kind !== "CallExpr" || consumer.kind !== "CallExpr")
14160
+ return;
14161
+ const fed = producedLiteral(producer);
14162
+ if (fed === null) return;
14163
+ const words = (consumer.Args || []).flatMap(
14164
+ (a) => resolveGitWords(a, this.treeTopVars, this.appended)
14165
+ );
14166
+ const head = unwrapCommandHead(words);
14167
+ const viaXargs = words.slice(0, head).some((w) => baseWord(w) === "xargs");
14168
+ const fromFile = words.findIndex(
14169
+ (w) => w === "--pathspec-from-file=-" || w === "--pathspec-from-file"
14170
+ );
14171
+ if (!viaXargs && fromFile < 0) return;
14172
+ let fedWords;
14173
+ if (fromFile >= 0) {
14174
+ fedWords = words.filter(
14175
+ (w, k) => !(k === fromFile || w === "-" && words[k - 1] === "--pathspec-from-file")
14176
+ );
14177
+ fedWords.push(fed);
14178
+ } else fedWords = [...words, fed];
14179
+ this.visitWords(fedWords, /* @__PURE__ */ new Map(), depth, false);
14180
+ }
14181
+ /**
14182
+ * node9Firewall#385 (e): a hook file written with a body that checks
14183
+ * nothing (`cat > .githooks/pre-commit <<'SH' exit 0 SH`, `echo 'exit 0'
14184
+ * > .git/hooks/pre-push`, `: > .githooks/pre-commit`). A real body (a
14185
+ * test, a linter) is ordinary work on the hooks.
14186
+ */
14187
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14188
+ visitHookWrite(stmt) {
14189
+ const cmd = stmt.Cmd;
14190
+ if (!cmd || cmd.kind !== "CallExpr") return;
14191
+ const redirs = stmt.Redirs || [];
14192
+ const target = redirs.find((r) => r?.Word && !r.Hdoc && (r.N == null || r.N.Value === "1"));
14193
+ if (!target) return;
14194
+ const path = resolveWordLiteral(target.Word);
14195
+ if (path === null || !isLiveHookFile(path)) return;
14196
+ const hdoc = redirs.find((r) => r?.Hdoc);
14197
+ const words = (cmd.Args || []).map((a) => resolveWordLiteral(a));
14198
+ const head = baseWord(words[0]);
14199
+ let body = null;
14200
+ if (hdoc) body = resolveWordLiteral(hdoc.Hdoc);
14201
+ else if (head === ":" || head === "true" || words.length === 0) body = "";
14202
+ else if (head === "echo" || head === "printf") {
14203
+ const rest = words.slice(1);
14204
+ body = rest.some((w) => w === null) ? null : rest.filter((w) => !/^-[neE]+$/.test(w)).join(" ");
14205
+ if (body !== null) body = body.replace(/\\n/g, "\n");
14206
+ }
14207
+ if (body !== null && hookBodyIsEmpty(body)) this.found(hooksBypassed(shownOf(words)));
14208
+ }
14209
+ /** A statement that writes a literal text to a path, by redirect. */
14210
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14211
+ recordScriptWrite(stmt) {
14212
+ const cmd = stmt.Cmd;
14213
+ if (!cmd || cmd.kind !== "CallExpr") return;
14214
+ const redirs = stmt.Redirs || [];
14215
+ const target = redirs.find((r) => r?.Word && !r.Hdoc && (r.N == null || r.N.Value === "1"));
14216
+ if (!target) return;
14217
+ const path = resolveWordLiteral(target.Word);
14218
+ if (path === null) return;
14219
+ const append = /^>>/.test(target.Op?.toString() ?? "") || redirOpIsAppend(target);
14220
+ const hdoc = redirs.find((r) => r?.Hdoc);
14221
+ const words = (cmd.Args || []).map((a) => resolveWordLiteral(a));
14222
+ const head = baseWord(words[0]);
14223
+ let text = null;
14224
+ if (hdoc && (head === "cat" || head === "tee")) text = resolveWordLiteral(hdoc.Hdoc);
14225
+ else if (head === "echo" || head === "printf") {
14226
+ const rest = words.slice(1);
14227
+ text = rest.some((w) => w === null) ? null : rest.filter((w) => !/^-[neE]+$/.test(w)).join(" ");
14228
+ if (text !== null && head === "printf") text = text.replace(/\\n/g, "\n");
14229
+ } else return;
14230
+ const prev = this.written.get(path);
14231
+ if (text === null || append && prev === null) this.written.set(path, null);
14232
+ else this.written.set(path, append && typeof prev === "string" ? `${prev}
14233
+ ${text}` : text);
14234
+ }
14235
+ /** A statement that runs a path this command wrote: the text is the script. */
14236
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14237
+ visitWrittenScript(stmt, depth) {
14238
+ const cmd = stmt.Cmd;
14239
+ if (!cmd || cmd.kind !== "CallExpr" || this.written.size === 0 || depth >= MAX_PAYLOAD_DEPTH2)
14240
+ return;
14241
+ const words = (cmd.Args || []).map((a) => resolveWordLiteral(a));
14242
+ const head = unwrapCommandHead(words);
14243
+ const name = baseWord(words[head]);
14244
+ let ran = null;
14245
+ if (PAYLOAD_SHELLS.has(name) && name !== "eval") {
14246
+ const operand = words.slice(head + 1).find((w) => w === null || !w.startsWith("-"));
14247
+ if (typeof operand === "string") ran = operand;
14248
+ } else if (typeof words[head] === "string" && this.written.has(words[head])) {
14249
+ ran = words[head];
14250
+ }
14251
+ if (ran === null) return;
14252
+ const text = this.written.get(ran);
14253
+ if (typeof text === "string") this.runPayload(text, depth);
14254
+ }
13855
14255
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13856
14256
  visitHeredocShell(stmt, depth) {
13857
14257
  const cmd = stmt.Cmd;
@@ -14040,7 +14440,61 @@ function dynamicOptionWord(word) {
14040
14440
  if (/^--[a-z-]+=/.test(prefix) || /^-[cC]/.test(prefix)) return `${prefix}$\u2026`;
14041
14441
  return null;
14042
14442
  }
14043
- function resolveGitWords(word) {
14443
+ var NO_VARS = /* @__PURE__ */ new Set();
14444
+ var NO_APPENDS = /* @__PURE__ */ new Map();
14445
+ function arrayExpansionWords(word) {
14446
+ let parts = word?.Parts || [];
14447
+ if (parts.length === 1 && parts[0].kind === "DblQuoted") parts = parts[0].Parts || [];
14448
+ if (parts.length !== 1 || parts[0].kind !== "ParamExp" || !parts[0].Index) return null;
14449
+ const index = resolveWordLiteral(parts[0].Index);
14450
+ if (index !== "@" && index !== "*") return null;
14451
+ const elems = arrayElements(recordedExpansion(parts[0].Param?.Value));
14452
+ return elems;
14453
+ }
14454
+ function producedLiteral(call) {
14455
+ if ((call.Assigns || []).length > 0) return null;
14456
+ const words = (call.Args || []).map((a) => resolveWordLiteral(a));
14457
+ if (words.length === 0 || words.some((w) => w === null)) return null;
14458
+ const head = baseWord(words[0]);
14459
+ const rest = words.slice(1);
14460
+ if (head === "git" && rest[0] === "rev-parse" && rest[1] === "--show-toplevel" && rest.length === 2)
14461
+ return ":/";
14462
+ if (head === "echo") {
14463
+ let i = 0;
14464
+ while (i < rest.length && /^-[neE]+$/.test(rest[i])) i++;
14465
+ return rest.length - i === 1 ? rest[i] : null;
14466
+ }
14467
+ if (head === "printf" && rest.length === 2 && /^%s(\\[0n])?$/.test(rest[0])) return rest[1];
14468
+ return null;
14469
+ }
14470
+ function treeTopWord(word, treeTopVars = NO_VARS) {
14471
+ let parts = word?.Parts || [];
14472
+ if (parts.length === 1 && parts[0].kind === "DblQuoted") parts = parts[0].Parts || [];
14473
+ if (parts.length !== 1) return false;
14474
+ const p = parts[0];
14475
+ if (p.kind === "ParamExp") {
14476
+ const name = plainParamName(word)?.name;
14477
+ return name === "PWD" || name !== void 0 && treeTopVars.has(name);
14478
+ }
14479
+ if (p.kind !== "CmdSubst") return false;
14480
+ const stmts = p.Stmts || [];
14481
+ if (stmts.length !== 1 || !stmts[0].Cmd || stmts[0].Cmd.kind !== "CallExpr") return false;
14482
+ const words = (stmts[0].Cmd.Args || []).map((a) => resolveWordLiteral(a));
14483
+ if (words.some((w) => w === null)) return false;
14484
+ const head = baseWord(words[0]);
14485
+ if (head === "pwd") return words.length === 1 || words[1] === "-P" || words[1] === "-L";
14486
+ return head === "git" && words[1] === "rev-parse" && words[2] === "--show-toplevel";
14487
+ }
14488
+ function resolveGitWords(word, treeTopVars = NO_VARS, appended = NO_APPENDS) {
14489
+ if (treeTopWord(word, treeTopVars)) return [":/"];
14490
+ const plain = plainParamName(word);
14491
+ if (plain && appended.has(plain.name)) {
14492
+ const v = appended.get(plain.name);
14493
+ if (v === null || v === void 0) return [null];
14494
+ return plain.quoted ? [v] : splitFields(v);
14495
+ }
14496
+ const elems = arrayExpansionWords(word);
14497
+ if (elems !== null) return elems;
14044
14498
  const value = resolveWordLiteral(word);
14045
14499
  if (value === null) {
14046
14500
  if (isPositionalParam(word)) return boundPositionals() ?? [POSITIONAL2];
@@ -14206,6 +14660,8 @@ function classify(inv) {
14206
14660
  if (o.flags.has("-n") || o.flags.has("--dry-run")) break;
14207
14661
  const forced = o.flags.has("-f") || o.flags.has("--force") || o.flags.has("--force-with-lease") || o.flags.has("--force-if-includes") || o.flags.has("--mirror") || o.operands.some((r) => r.startsWith("+"));
14208
14662
  if (forced) found(FORCE_PUSH);
14663
+ const deletes = o.flags.has("-d") || o.flags.has("--delete") || o.operands.some((r) => /^:[^:]/.test(r));
14664
+ if (deletes) found(DESTRUCTIVE);
14209
14665
  break;
14210
14666
  }
14211
14667
  case "reset": {
@@ -14233,11 +14689,74 @@ function classify(inv) {
14233
14689
  if (o.flags.has("-d") || o.flags.has("--delete")) found(DESTRUCTIVE);
14234
14690
  break;
14235
14691
  }
14692
+ // node9Firewall#385: history and work discarded through plumbing. A ref
14693
+ // deleted by hand, a stash dropped, the reflog expired or pruned: the
14694
+ // commits behind them are gone the way `branch -D` loses them.
14695
+ case "update-ref": {
14696
+ const o = parseOptions(inv.args, "m", /* @__PURE__ */ new Set());
14697
+ if (o.flags.has("-d") && (o.dynamic || o.operands.some(isHistoryRef))) found(DESTRUCTIVE);
14698
+ break;
14699
+ }
14700
+ case "reflog": {
14701
+ const o = parseOptions(inv.args, "", /* @__PURE__ */ new Set());
14702
+ if (o.operands[0] === "expire" || o.operands[0] === "delete") found(DESTRUCTIVE);
14703
+ break;
14704
+ }
14705
+ case "gc": {
14706
+ if (inv.config.get("gc.reflogexpire") === "now") found(DESTRUCTIVE);
14707
+ break;
14708
+ }
14709
+ case "stash": {
14710
+ const o = parseOptions(inv.args, "", /* @__PURE__ */ new Set());
14711
+ if (o.operands[0] === "clear" || o.operands[0] === "drop") found(DESTRUCTIVE);
14712
+ break;
14713
+ }
14714
+ case "worktree": {
14715
+ const o = parseOptions(inv.args, "", /* @__PURE__ */ new Set());
14716
+ if (o.operands[0] === "remove" && (o.flags.has("-f") || o.flags.has("--force")))
14717
+ found(DESTRUCTIVE);
14718
+ break;
14719
+ }
14720
+ // The working tree overwritten: `restore` from another ref, a forced
14721
+ // checkout, or `checkout -- .` (every local change dropped). A bare
14722
+ // `restore .` or `checkout .` stays an ordinary undo, as pinned.
14723
+ case "restore": {
14724
+ const o = parseOptions(inv.args, "s", RESTORE_LONG_VALUE);
14725
+ const src = restoreSource(inv.args);
14726
+ const whole = o.dynamic || o.operands.some(wholeTree);
14727
+ if (src !== null && src !== "HEAD" && whole) found(DESTRUCTIVE);
14728
+ break;
14729
+ }
14730
+ case "checkout": {
14731
+ const o = parseOptions(inv.args, "bB", CHECKOUT_LONG_VALUE);
14732
+ const forced = o.flags.has("-f") || o.flags.has("--force");
14733
+ const dropAll = inv.args.includes("--") && o.operands.some(wholeTree);
14734
+ if (forced || dropAll) found(DESTRUCTIVE);
14735
+ break;
14736
+ }
14236
14737
  default:
14237
14738
  break;
14238
14739
  }
14239
14740
  return out;
14240
14741
  }
14742
+ function isExcludePathspec(operand) {
14743
+ return /^:[!^]/.test(operand) || /^:\([^)]*\bexclude\b[^)]*\)/.test(operand);
14744
+ }
14745
+ function restoreSource(args) {
14746
+ for (let i = 0; i < args.length; i++) {
14747
+ const w = args[i];
14748
+ if (w === null) continue;
14749
+ if (w.startsWith("--source=")) return w.slice("--source=".length);
14750
+ if (w === "--source" || w === "-s") return args[i + 1] ?? null;
14751
+ if (/^-s./.test(w)) return w.slice(2);
14752
+ }
14753
+ return null;
14754
+ }
14755
+ function isHistoryRef(ref) {
14756
+ return /^refs\/(heads|stash)(\/|$)/.test(ref);
14757
+ }
14758
+ var RESTORE_LONG_VALUE = /* @__PURE__ */ new Set(["--source", "--pathspec-from-file"]);
14759
+ var CHECKOUT_LONG_VALUE = /* @__PURE__ */ new Set(["--pathspec-from-file", "--orphan", "--conflict"]);
14241
14760
  var HOOKS_BYPASS = {
14242
14761
  checkId: "commands.git-hooks-bypass",
14243
14762
  ruleName: "review-git-hooks-bypass",
@@ -14304,6 +14823,7 @@ function hooksBypass(inv) {
14304
14823
  const o = parseOptions(inv.args, "mFCcut", COMMIT_LONG_VALUE);
14305
14824
  return o.flags.has("-n") || o.flags.has("--no-verify");
14306
14825
  }
14826
+ if (sub === "commit-tree") return true;
14307
14827
  if (sub !== void 0 && NO_VERIFY_SUBS.has(sub)) {
14308
14828
  return inv.args.some((a) => a === "--no-verify");
14309
14829
  }
@@ -14356,7 +14876,20 @@ function configWritesHooksPath(args) {
14356
14876
  return write;
14357
14877
  }
14358
14878
  function isHookPath(word) {
14359
- return /(^|[\\/])(\.git[\\/]hooks|\.husky)([\\/]|$)/.test(word);
14879
+ return /(^|[\\/])(\.git[\\/]hooks|\.husky|\.githooks)([\\/]|$)/.test(word);
14880
+ }
14881
+ function isLiveHookFile(word) {
14882
+ if (!isHookPath(word)) return false;
14883
+ const m = /(^|[\\/])(\.git[\\/]hooks|\.husky|\.githooks)(?:[\\/](.*))?$/.exec(word);
14884
+ if (!m) return false;
14885
+ const rest = m[3] ?? "";
14886
+ if (rest === "" || rest === "_") return true;
14887
+ const leaf = rest.replace(/^_[\\/]/, "");
14888
+ return /^[a-z-]+$/.test(leaf);
14889
+ }
14890
+ function hookBodyIsEmpty(text) {
14891
+ const lines = text.split(/\r?\n/).map((l) => l.trim()).filter((l) => l !== "" && !l.startsWith("#"));
14892
+ return lines.every((l) => /^(exit(\s+0)?|true|:|set\s+-[a-zA-Z]+|set\s+-o\s+\w+)$/.test(l));
14360
14893
  }
14361
14894
  var CHMOD_OPTION_RE = /^-[RvcfHLP]+$/;
14362
14895
  function modeRemovesExecute(mode) {
@@ -14366,6 +14899,23 @@ function modeRemovesExecute(mode) {
14366
14899
  }
14367
14900
  return mode.split(",").some((part) => /^[ugoa]*-[rwst]*x/.test(part));
14368
14901
  }
14902
+ function redirOpIsAppend(redir) {
14903
+ return redir?.Op === appendOp();
14904
+ }
14905
+ var _appendOp = null;
14906
+ function appendOp() {
14907
+ if (_appendOp !== null) return _appendOp;
14908
+ try {
14909
+ const f = parseShared("echo x >> y");
14910
+ _appendOp = typeof f === "symbol" ? -1 : f.Stmts[0].Redirs[0].Op;
14911
+ } catch {
14912
+ _appendOp = -1;
14913
+ }
14914
+ return _appendOp;
14915
+ }
14916
+ function hooksBypassed(shown) {
14917
+ return { ...HOOKS_BYPASS, shown, reason: `${HOOKS_BYPASS.reason}: ${shown}` };
14918
+ }
14369
14919
  function chmodDisarmsHook(args, shown) {
14370
14920
  let i = 0;
14371
14921
  while (i < args.length) {
@@ -14416,6 +14966,7 @@ function stagesEverything(inv) {
14416
14966
  const sub = inv.sub?.toLowerCase();
14417
14967
  const prefix = chdirPrefix(inv);
14418
14968
  const judge = (operands2) => {
14969
+ if (operands2.length > 0 && operands2.every(isExcludePathspec)) return {};
14419
14970
  let conditional = false;
14420
14971
  for (const operand of operands2) {
14421
14972
  if (!wholeTree(operand)) continue;
@@ -14519,9 +15070,9 @@ var INSTRUCTION_NAMES = /* @__PURE__ */ new Set([
14519
15070
  var SETTINGS_RE = /\/(?:\.claude\/settings(?:\.local)?\.json|\.gemini\/settings\.json|\.codex\/hooks\.json|\.cursor\/hooks\.json)$/i;
14520
15071
  function agentFileKind(p) {
14521
15072
  const lower2 = p.toLowerCase();
14522
- const base2 = lower2.slice(lower2.lastIndexOf("/") + 1);
14523
- if (INSTRUCTION_NAMES.has(base2)) return "instructions";
14524
- if (base2 === "copilot-instructions.md" && lower2.endsWith("/.github/" + base2))
15073
+ const base3 = lower2.slice(lower2.lastIndexOf("/") + 1);
15074
+ if (INSTRUCTION_NAMES.has(base3)) return "instructions";
15075
+ if (base3 === "copilot-instructions.md" && lower2.endsWith("/.github/" + base3))
14525
15076
  return "instructions";
14526
15077
  if (/\/\.cursor\/rules(?:\/|$)/.test(lower2)) return "instructions";
14527
15078
  if (/\/\.claude\/projects\/[^/]+\/memory(?:\/|$)/.test(lower2)) return "memory";
@@ -14691,7 +15242,7 @@ function evaluateAgentFileWrite(args, accesses, context, settings, shell, hooks
14691
15242
  skills: "agent skill",
14692
15243
  settings: "agent settings"
14693
15244
  };
14694
- const base2 = `${kindLabel[kind]} written: ${access.path}`;
15245
+ const base3 = `${kindLabel[kind]} written: ${access.path}`;
14695
15246
  if (!signal && !every) {
14696
15247
  return {
14697
15248
  decision: "allow",
@@ -14701,14 +15252,14 @@ function evaluateAgentFileWrite(args, accesses, context, settings, shell, hooks
14701
15252
  path: access.path,
14702
15253
  operation: access.operation,
14703
15254
  kind,
14704
- reason: base2,
15255
+ reason: base3,
14705
15256
  ruleDescription: "The AI writes to a file every later agent session loads as instructions.",
14706
- blockedByLabel: `Node9 Files: ${base2}`,
15257
+ blockedByLabel: `Node9 Files: ${base3}`,
14707
15258
  tier: 2
14708
15259
  };
14709
15260
  }
14710
15261
  const ruleName = signal === "content" ? "review-agent-file-content" : signal === "hooks" ? "review-agent-hooks-change" : "review-agent-file-write";
14711
- const reason = signal ? `${base2} (${detail})` : base2;
15262
+ const reason = signal ? `${base3} (${detail})` : base3;
14712
15263
  const description = signal === "content" ? "The AI writes an instruction into a file every later agent session loads: to hide something from you, to skip approvals or the guard, or to read or send a secret. It would persist past this session; confirm it is yours." : signal === "hooks" ? "The AI changes the hooks in the agent's settings. Hooks are how node9 and your other checks run before each tool call; a change here can disarm them." : "The AI writes to a file every later agent session loads as instructions (CLAUDE.md, AGENTS.md, memory, agents, commands). Confirm the change is yours.";
14713
15264
  return {
14714
15265
  decision: value === "log" ? "allow" : value,
@@ -14760,7 +15311,7 @@ var PRESCREEN_RE = /\/dev\/(?:tcp|udp)|\b(?:nc|ncat|netcat|telnet|socat|s_client
14760
15311
  var MAX_PAYLOAD_DEPTH3 = 4;
14761
15312
  var CACHE_MAX2 = 1e3;
14762
15313
  var cache2 = /* @__PURE__ */ new Map();
14763
- function isPipeOp(op) {
15314
+ function isPipeOp2(op) {
14764
15315
  return !isListOp(op);
14765
15316
  }
14766
15317
  var dupInOp = null;
@@ -15012,7 +15563,7 @@ var OutboundWalk = class {
15012
15563
  this.visitStmt(n, depth);
15013
15564
  return true;
15014
15565
  }
15015
- if (type === "BinaryCmd" && isPipeOp(n.Op)) {
15566
+ if (type === "BinaryCmd" && isPipeOp2(n.Op)) {
15016
15567
  this.visitPipeline(n);
15017
15568
  return true;
15018
15569
  }
@@ -15113,7 +15664,7 @@ var OutboundWalk = class {
15113
15664
  const stages = [];
15114
15665
  const flatten = (s) => {
15115
15666
  const c = s?.Cmd;
15116
- if (c && c.kind === "BinaryCmd" && isPipeOp(c.Op)) {
15667
+ if (c && c.kind === "BinaryCmd" && isPipeOp2(c.Op)) {
15117
15668
  flatten(c.X);
15118
15669
  flatten(c.Y);
15119
15670
  } else stages.push(s);
@@ -17428,6 +17979,175 @@ function scanArgumentSecrets(args) {
17428
17979
  } : null;
17429
17980
  }
17430
17981
 
17982
+ // src/shell/node9-disarm.ts
17983
+ var RULE_NAME2 = "review-node9-disarm";
17984
+ var DESCRIPTION = "The AI wants to stop node9, remove it, or change its own files. These are your commands to run, not the agent's: with the daemon stopped the outside-content and taint checks are off.";
17985
+ var DAEMON_CMDLINES = [
17986
+ "node /usr/lib/node_modules/@node9/proxy/dist/cli.js daemon start",
17987
+ "node9 daemon start"
17988
+ ];
17989
+ var DAEMON_NAMES = ["node", "node9"];
17990
+ var KILLALL_NAMES = /* @__PURE__ */ new Set(["node", "node9", "node.exe", "node9.exe"]);
17991
+ var STOP_SYSTEMCTL = /* @__PURE__ */ new Set(["stop", "disable", "mask", "kill"]);
17992
+ var STOP_LAUNCHCTL = /* @__PURE__ */ new Set(["unload", "bootout", "remove", "stop", "kill", "disable"]);
17993
+ var PKILL_VALUE_FLAGS = /* @__PURE__ */ new Set([
17994
+ "-u",
17995
+ "-U",
17996
+ "-g",
17997
+ "-G",
17998
+ "-P",
17999
+ "-s",
18000
+ "-t",
18001
+ "-F",
18002
+ "--signal",
18003
+ "--euid",
18004
+ "--uid",
18005
+ "--pgroup",
18006
+ "--group",
18007
+ "--parent",
18008
+ "--session",
18009
+ "--terminal",
18010
+ "--pidfile",
18011
+ "--ns",
18012
+ "--nslist"
18013
+ ]);
18014
+ var NAME_PRESCREEN_RE = /node9|kill|systemctl|launchctl|daemon/i;
18015
+ function patternSelects(pattern, targets) {
18016
+ const pieces = pattern.toLowerCase().split(/[\\^$.*+?()[\]{}|]+/).filter(Boolean);
18017
+ if (pieces.length === 0) return false;
18018
+ return targets.some((t) => pieces.every((p) => t.includes(p)));
18019
+ }
18020
+ function sourceText(bytes, pos, end) {
18021
+ if (typeof pos !== "number" || typeof end !== "number" || pos < 0 || end < pos) return "";
18022
+ return new TextDecoder().decode(bytes.subarray(pos, end));
18023
+ }
18024
+ var base2 = (w) => (w ?? "").split(/[\\/]/).pop()?.toLowerCase() ?? "";
18025
+ function nextOperand(words, from) {
18026
+ for (let i = from; i < words.length; i++) {
18027
+ const w = words[i];
18028
+ if (w !== null && w.startsWith("-")) continue;
18029
+ return i;
18030
+ }
18031
+ return -1;
18032
+ }
18033
+ function node9Command(words, h) {
18034
+ const head = base2(words[h]);
18035
+ if (head !== "node9" && head !== "node9.cmd" && words[h] !== "@node9/proxy") return null;
18036
+ const s = nextOperand(words, h + 1);
18037
+ const sub = s < 0 ? "" : (words[s] ?? "").toLowerCase();
18038
+ if (sub === "uninstall") return "node9 uninstall";
18039
+ if (sub !== "daemon") return null;
18040
+ const a = nextOperand(words, s + 1);
18041
+ const action = a < 0 ? "" : (words[a] ?? "").toLowerCase();
18042
+ return action === "stop" || action === "uninstall" ? `node9 daemon ${action}` : null;
18043
+ }
18044
+ var HOME_PID_FILE_RE = /(?:^|[\s"'(=`])(?:~|\$HOME|\$\{HOME\}|\/home\/[^/\s]+|\/Users\/[^/\s]+|\/root)\/\.node9\/daemon\.pid/;
18045
+ function killsDaemon(words, texts, h, daemonPid) {
18046
+ const head = base2(words[h]);
18047
+ const args = words.slice(h + 1);
18048
+ if (head === "kill") {
18049
+ for (let i = 0; i < args.length; i++) {
18050
+ const w = args[i];
18051
+ if (w === "-s" || w === "-n") {
18052
+ i++;
18053
+ continue;
18054
+ }
18055
+ if (w !== null && w.startsWith("-")) continue;
18056
+ if (w === null) {
18057
+ if (HOME_PID_FILE_RE.test(texts[h + 1 + i] ?? "")) return "kill of the pid in daemon.pid";
18058
+ continue;
18059
+ }
18060
+ if (daemonPid !== null && w === String(daemonPid)) return `kill ${w} (the node9 daemon)`;
18061
+ }
18062
+ return null;
18063
+ }
18064
+ if (head === "pkill") {
18065
+ let full = false;
18066
+ let pattern = null;
18067
+ for (let i = 0; i < args.length; i++) {
18068
+ const w = args[i];
18069
+ if (w === null) continue;
18070
+ if (PKILL_VALUE_FLAGS.has(w)) {
18071
+ i++;
18072
+ continue;
18073
+ }
18074
+ if (w === "--full") full = true;
18075
+ else if (/^-[a-zA-Z]+$/.test(w) && w.includes("f")) full = true;
18076
+ if (w.startsWith("-")) continue;
18077
+ pattern = w;
18078
+ }
18079
+ if (pattern === null) return null;
18080
+ return patternSelects(pattern, full ? DAEMON_CMDLINES : DAEMON_NAMES) ? `pkill ${full ? "-f " : ""}${pattern}` : null;
18081
+ }
18082
+ if (head === "killall") {
18083
+ const regex = args.some((w) => w === "-r" || w === "--regexp");
18084
+ for (const w of args) {
18085
+ if (w === null || w.startsWith("-")) continue;
18086
+ if (regex ? patternSelects(w, DAEMON_NAMES) : KILLALL_NAMES.has(w.toLowerCase()))
18087
+ return `killall ${w}`;
18088
+ }
18089
+ return null;
18090
+ }
18091
+ if (head === "taskkill" || head === "taskkill.exe") {
18092
+ for (let i = 0; i < args.length - 1; i++) {
18093
+ const flag = (args[i] ?? "").toLowerCase();
18094
+ const value = (args[i + 1] ?? "").toLowerCase();
18095
+ if ((flag === "/im" || flag === "-im") && KILLALL_NAMES.has(value))
18096
+ return `taskkill /IM ${value}`;
18097
+ if ((flag === "/pid" || flag === "-pid") && daemonPid !== null && value === String(daemonPid))
18098
+ return `taskkill /PID ${value} (the node9 daemon)`;
18099
+ }
18100
+ }
18101
+ return null;
18102
+ }
18103
+ function stopsService(words, h) {
18104
+ const head = base2(words[h]);
18105
+ const args = words.slice(h + 1).map((w) => (w ?? "").toLowerCase());
18106
+ if (head === "systemctl") {
18107
+ const action = args.find((w) => STOP_SYSTEMCTL.has(w));
18108
+ if (action && args.some((w) => /^node9-daemon(\.service)?$/.test(w)))
18109
+ return `systemctl ${action} node9-daemon`;
18110
+ }
18111
+ if (head === "launchctl") {
18112
+ const action = args.find((w) => STOP_LAUNCHCTL.has(w));
18113
+ if (action && args.some((w) => w.includes("ai.node9.daemon")))
18114
+ return `launchctl ${action} ai.node9.daemon`;
18115
+ }
18116
+ return null;
18117
+ }
18118
+ function analyzeNode9Disarm(command, daemonPid = null, depth = 0) {
18119
+ if (depth > 3 || !NAME_PRESCREEN_RE.test(command.replace(/[\\'"]/g, ""))) return null;
18120
+ let shown = null;
18121
+ const bytes = new TextEncoder().encode(command);
18122
+ try {
18123
+ walkCommandScope(command, (node) => {
18124
+ if (shown !== null) return false;
18125
+ const n = node;
18126
+ if (!n || n.kind !== "CallExpr") return true;
18127
+ const words = (n.Args || []).map((a) => resolveWordLiteral(a));
18128
+ if (words.length === 0) return true;
18129
+ const texts = (n.Args || []).map((a) => sourceText(bytes, a.pos, a.end));
18130
+ const h = unwrapCommandHead(words);
18131
+ shown = node9Command(words, h) ?? killsDaemon(words, texts, h, daemonPid) ?? stopsService(words, h);
18132
+ if (shown === null) {
18133
+ const payload = literalShellPayload(words, base2(words[0]));
18134
+ if (payload) {
18135
+ const inner = analyzeNode9Disarm(payload, daemonPid, depth + 1);
18136
+ if (inner) shown = inner.reason.replace(/^node9 switched off by the agent: /, "");
18137
+ }
18138
+ }
18139
+ return true;
18140
+ });
18141
+ } catch {
18142
+ }
18143
+ if (shown === null) return null;
18144
+ return {
18145
+ ruleName: RULE_NAME2,
18146
+ reason: `node9 switched off by the agent: ${shown}`,
18147
+ description: DESCRIPTION
18148
+ };
18149
+ }
18150
+
17431
18151
  // src/policy/index.ts
17432
18152
  function catalogSettings(config) {
17433
18153
  return catalogSettingsFromConfig(config.settings, config.policy);
@@ -17594,7 +18314,7 @@ async function evaluatePolicy(config, toolName, args, context = {}, hostHooks =
17594
18314
  }
17595
18315
  async function evaluatePolicyCore(config, toolName, args, context = {}, hooks = {}) {
17596
18316
  const { agent, cwd, activeEnvironment } = context;
17597
- const { checkProvenance, isTrustedHost, isConfiguredRegistry, isGitWorkTreeTop } = hooks;
18317
+ const { checkProvenance, isTrustedHost, isConfiguredRegistry, isGitWorkTreeTop, daemonPid } = hooks;
17598
18318
  const settingsView = catalogSettings(config);
17599
18319
  const layers = inspectionLayers(config.policy);
17600
18320
  const cv = (id) => checkValue(settingsView, id);
@@ -17779,6 +18499,23 @@ async function evaluatePolicyCore(config, toolName, args, context = {}, hooks =
17779
18499
  else if (v && !pendingAstReview) pendingAstReview = v;
17780
18500
  }
17781
18501
  }
18502
+ if (cv("commands.node9-disarm") !== "off") {
18503
+ const finding = analyzeNode9Disarm(bashCommand, daemonPid?.() ?? null);
18504
+ if (finding) {
18505
+ const v = applyCheckValue(cv("commands.node9-disarm"), {
18506
+ decision: "review",
18507
+ blockedByLabel: `Node9 (AST): ${finding.ruleName}`,
18508
+ reason: finding.reason,
18509
+ tier: 2,
18510
+ ruleName: finding.ruleName,
18511
+ ruleDescription: finding.description,
18512
+ checkId: "commands.node9-disarm"
18513
+ });
18514
+ if (v?.logged) noteLogged(v);
18515
+ else if (v?.decision === "block") return v;
18516
+ else if (v && !pendingAstReview) pendingAstReview = v;
18517
+ }
18518
+ }
17782
18519
  }
17783
18520
  if (config.policy.smartRules.length > 0) {
17784
18521
  const rmCleanupWaiver = bashCommand !== null && isRmCreatedInCommandCleanup(bashCommand);
@@ -17888,7 +18625,7 @@ async function evaluatePolicyCore(config, toolName, args, context = {}, hooks =
17888
18625
  if (v?.logged) noteLogged(v);
17889
18626
  else if (v) candidates.push(v);
17890
18627
  };
17891
- const inline = reviewsEveryInline(config.settings.mode) ? detectInlineExec(shellCommand) ? void 0 : null : inlineExecReview(shellCommand);
18628
+ const inline = reviewsEveryInline(config.settings.mode) ? detectInlineExec(shellCommand) ? void 0 : null : inlineExecReview(shellCommand, config.policy.jailPaths);
17892
18629
  if (inline !== null) {
17893
18630
  consider("commands.inline-exec", {
17894
18631
  decision: "review",
@@ -18370,12 +19107,12 @@ function hasRoutingNumber(text) {
18370
19107
  return false;
18371
19108
  }
18372
19109
  var PII_IBAN_RE = /\b[A-Z]{2}\d{2}(?:[A-Z0-9]|[ -][A-Z0-9]){11,30}\b/;
18373
- function* validCardRuns(text, base2, exemptFractions = true) {
18374
- const re = new RegExp(base2.source, "g");
19110
+ function* validCardRuns(text, base3, exemptFractions = true) {
19111
+ const re = new RegExp(base3.source, "g");
18375
19112
  let m;
18376
19113
  while ((m = re.exec(text)) !== null) {
18377
19114
  const digits = m[0].replace(/\D/g, "");
18378
- const fraction = exemptFractions && isDecimalFraction(text, m.index, digits.length === m[0].length);
19115
+ const fraction = exemptFractions && (isDecimalFraction(text, m.index, digits.length === m[0].length) || isInteriorDotNumber(m[0]));
18379
19116
  if (!fraction && validateLuhn(digits)) {
18380
19117
  yield { index: m.index, length: m[0].length, digits };
18381
19118
  } else {
@@ -18384,17 +19121,17 @@ function* validCardRuns(text, base2, exemptFractions = true) {
18384
19121
  }
18385
19122
  }
18386
19123
  function hasValidCard(text) {
18387
- for (const base2 of CARD_PATTERNS) {
18388
- if (!validCardRuns(text, base2).next().done) return true;
19124
+ for (const base3 of CARD_PATTERNS) {
19125
+ if (!validCardRuns(text, base3).next().done) return true;
18389
19126
  }
18390
19127
  return false;
18391
19128
  }
18392
19129
  function replaceValidCards(text, replace, { exemptFractions = true } = {}) {
18393
19130
  let out = text;
18394
- for (const base2 of CARD_PATTERNS) {
19131
+ for (const base3 of CARD_PATTERNS) {
18395
19132
  let res = "";
18396
19133
  let last = 0;
18397
- for (const run of validCardRuns(out, base2, exemptFractions)) {
19134
+ for (const run of validCardRuns(out, base3, exemptFractions)) {
18398
19135
  res += out.slice(last, run.index) + replace(run.digits);
18399
19136
  last = run.index + run.length;
18400
19137
  }
@@ -18402,6 +19139,12 @@ function replaceValidCards(text, replace, { exemptFractions = true } = {}) {
18402
19139
  }
18403
19140
  return out;
18404
19141
  }
19142
+ function isInteriorDotNumber(run) {
19143
+ const first = run.indexOf(".");
19144
+ if (first <= 0 || first === run.length - 1) return false;
19145
+ if (run.indexOf(".", first + 1) !== -1) return false;
19146
+ return !/[-\s]/.test(run);
19147
+ }
18405
19148
  function isDecimalFraction(text, index, unseparated) {
18406
19149
  if (!unseparated) return false;
18407
19150
  const sep = text[index - 1];
@@ -18677,9 +19420,9 @@ function maskLeaf(value, key, depth) {
18677
19420
  const used = /* @__PURE__ */ new Set();
18678
19421
  return Object.fromEntries(
18679
19422
  Object.entries(value).map(([k, v]) => {
18680
- const base2 = maskPersonalData(k);
18681
- let name = base2;
18682
- for (let n = 2; used.has(name); n++) name = `${base2}#${n}`;
19423
+ const base3 = maskPersonalData(k);
19424
+ let name = base3;
19425
+ for (let n = 2; used.has(name); n++) name = `${base3}#${n}`;
18683
19426
  used.add(name);
18684
19427
  return [name, maskLeaf(v, k, depth + 1)];
18685
19428
  })
@@ -19727,8 +20470,8 @@ function matchCanaryArgs(args, values) {
19727
20470
 
19728
20471
  // src/scan/canonical.ts
19729
20472
  var LONG_OUTPUT_THRESHOLD_BYTES = 100 * 1024;
19730
- var CANONICAL_EXTRACTOR_VERSION = "canonical-v36";
19731
- var CANONICAL_EXTRACTOR_HASH = "5ed06e803cc1d365";
20473
+ var CANONICAL_EXTRACTOR_VERSION = "canonical-v38";
20474
+ var CANONICAL_EXTRACTOR_HASH = "2d3dfcccff2c2f65";
19732
20475
  var DEDUPE_PREVIEW_LEN = 120;
19733
20476
  function extractCanonicalFindings(call, ctx) {
19734
20477
  const out = [];
@@ -20309,6 +21052,7 @@ var ENGINE_VERSION = "1.4.0";
20309
21052
  gitInvocations,
20310
21053
  gitRepoPath,
20311
21054
  hashDestination,
21055
+ holdsSendsWithoutDaemon,
20312
21056
  hostMatches,
20313
21057
  incompleteFileVerdict,
20314
21058
  inlineExecDescription,