@orchestraai/agent-tools 0.10.17 → 0.10.19
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/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/.devin/adapter.json +1 -1
- package/.hermes/adapter.json +1 -1
- package/.opencode/adapter.json +1 -1
- package/dist/benchmarks-mcp.d.ts +35 -2
- package/dist/benchmarks-mcp.js +108 -50
- package/dist/benchmarks-mcp.js.map +1 -1
- package/dist/commands/trust.d.ts +0 -7
- package/dist/commands/trust.js +62 -0
- package/dist/commands/trust.js.map +1 -1
- package/dist/config/spend-approval.d.ts +45 -0
- package/dist/config/spend-approval.js +203 -0
- package/dist/config/spend-approval.js.map +1 -0
- package/dist/evals/authoring-contracts.d.ts +1 -1
- package/dist/runtime/conversation/benchmark-extension.d.ts +14 -2
- package/dist/runtime/conversation/benchmark-extension.js +71 -52
- package/dist/runtime/conversation/benchmark-extension.js.map +1 -1
- package/dist/runtime/conversation/command-guard.js +349 -15
- package/dist/runtime/conversation/command-guard.js.map +1 -1
- package/dist/runtime/conversation/shell-parse.d.ts +2 -0
- package/dist/runtime/conversation/shell-parse.js +12 -4
- package/dist/runtime/conversation/shell-parse.js.map +1 -1
- package/docs/agent-operator-surface.md +6 -2
- package/docs/security.md +12 -2
- package/package.json +1 -1
- package/skills/operate-benchmark-lab/SKILL.md +5 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"benchmark-extension.js","sourceRoot":"","sources":["../../../src/runtime/conversation/benchmark-extension.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,kEAAkE;AAClE,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,8DAA8D;AAC9D,EAAE;AACF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K,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAG,yBAAyB,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,QAAQ,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YAClC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,0BAA0B,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
1
|
+
{"version":3,"file":"benchmark-extension.js","sourceRoot":"","sources":["../../../src/runtime/conversation/benchmark-extension.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,kEAAkE;AAClE,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,8DAA8D;AAC9D,EAAE;AACF,sEAAsE;AACtE,6EAA6E;AAC7E,4EAA4E;AAC5E,yEAAyE;AACzE,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;AACzE,2EAA2E;AAC3E,6EAA6E;AAC7E,uEAAuE;AACvE,4EAA4E;AAC5E,4EAA4E;AAC5E,iBAAiB;AACjB,EAAE;AACF,6EAA6E;AAC7E,sEAAsE;AACtE,wEAAwE;AACxE,6EAA6E;AAC7E,6EAA6E;AAC7E,uCAAuC;AACvC,EAAE;AACF,kEAAkE;AAClE,qEAAqE;AACrE,4BAA4B;AAE5B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,QAAQ,EA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,CAAC,EAAgB;IACtD,KAAK,MAAM,IAAI,IAAI,wBAAwB,EAAE,EAAE,CAAC;QAC9C,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IACD,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;QAC3B,2EAA2E;QAC3E,MAAM,QAAQ,GAAG,yBAAyB,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,QAAQ,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YAClC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAC3C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,0BAA0B,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
1
2
|
import { parseShell, ShellParseError, } from "./shell-parse.js";
|
|
2
3
|
const SHELL_TOOL_NAMES = new Set([
|
|
3
4
|
"bash",
|
|
@@ -21,6 +22,10 @@ const RULE_INFO = {
|
|
|
21
22
|
reason: "Recursive forced deletion can permanently remove uncommitted or user data.",
|
|
22
23
|
severity: "high",
|
|
23
24
|
},
|
|
25
|
+
"filesystem.sensitive-path-write": {
|
|
26
|
+
reason: "This command writes to a credential, SSH, shell startup, Git config, scheduler, or system file outside the workspace.",
|
|
27
|
+
severity: "high",
|
|
28
|
+
},
|
|
24
29
|
"storage.raw-device-write": {
|
|
25
30
|
reason: "This command formats, erases, or writes directly to a block device.",
|
|
26
31
|
severity: "critical",
|
|
@@ -53,6 +58,10 @@ const RULE_INFO = {
|
|
|
53
58
|
reason: "Piping downloaded content directly into a shell executes unreviewed remote code.",
|
|
54
59
|
severity: "high",
|
|
55
60
|
},
|
|
61
|
+
"operator.spend-approval": {
|
|
62
|
+
reason: "Approving benchmark spend is for the operator only: they run `orchestra trust approve-spend` themselves in a terminal. Commands may not run it or change its approvals file.",
|
|
63
|
+
severity: "high",
|
|
64
|
+
},
|
|
56
65
|
"shell.program-launcher-option": {
|
|
57
66
|
reason: "This option makes the tool run another program (for example a preprocessor, pager, or config-defined command), which the guard cannot review.",
|
|
58
67
|
severity: "high",
|
|
@@ -176,6 +185,11 @@ const PATTERN_RULES = [
|
|
|
176
185
|
id: "supply-chain.remote-pipe-shell",
|
|
177
186
|
matches: (command) => /\b(?:curl|wget)\b[^|\n]*\|\s*(?:sudo\s+)?(?:ba|z|k|fi)?sh\b/i.test(command),
|
|
178
187
|
},
|
|
188
|
+
{
|
|
189
|
+
// Seen in any position, so wrappers (script -c, sh -c, node -e) are covered too.
|
|
190
|
+
id: "operator.spend-approval",
|
|
191
|
+
matches: (command) => /\bapprove-spend\b|spend-approvals|UNDERSTUDY_SPEND_APPROVALS_FILE/i.test(command),
|
|
192
|
+
},
|
|
179
193
|
];
|
|
180
194
|
/* ------------------------------------------------------------------------ */
|
|
181
195
|
/* Parsed-command rules */
|
|
@@ -311,11 +325,212 @@ function safeToMask(span, kind) {
|
|
|
311
325
|
function shortCluster(options, letter) {
|
|
312
326
|
return options.some((option) => /^-[A-Za-z0-9]+$/.test(option) && option.slice(1).includes(letter));
|
|
313
327
|
}
|
|
328
|
+
const HOME_A = "\u0000home";
|
|
329
|
+
const HOME_B = "\u0000user";
|
|
330
|
+
const HOME = ["/", HOME_A, HOME_B];
|
|
331
|
+
const START = ["."];
|
|
332
|
+
const MAX_CWDS = 16;
|
|
333
|
+
/** Files and directories that a command should not write to. `**` matches the directory itself and everything below it. */
|
|
334
|
+
const SENSITIVE_HOME_PATHS = [
|
|
335
|
+
".ssh/**",
|
|
336
|
+
".bashrc", ".bash_profile", ".bash_login", ".bash_logout", ".profile", ".zshrc", ".zshenv", ".zprofile", ".zlogin",
|
|
337
|
+
".zlogout", ".kshrc", ".cshrc", ".tcshrc", ".login", ".config/fish/**",
|
|
338
|
+
".gitconfig", ".config/git/**",
|
|
339
|
+
".aws/**", ".netrc", ".npmrc", ".docker/config.json", ".kube/**", ".gnupg/**",
|
|
340
|
+
"Library/LaunchAgents/**", ".config/systemd/**",
|
|
341
|
+
".understudy/spend-approvals.json",
|
|
342
|
+
];
|
|
343
|
+
const SENSITIVE_SYSTEM_PATHS = [
|
|
344
|
+
"etc/**", "private/etc/**", "usr/**", "bin/**", "sbin/**", "boot/**", "lib/systemd/**",
|
|
345
|
+
"Library/LaunchAgents/**", "Library/LaunchDaemons/**",
|
|
346
|
+
"var/spool/cron/**", "var/at/**", "private/var/at/**",
|
|
347
|
+
];
|
|
348
|
+
const HOME_PATTERNS = SENSITIVE_HOME_PATHS.map((path) => [...HOME, ...path.split("/")]);
|
|
349
|
+
const SYSTEM_PATTERNS = SENSITIVE_SYSTEM_PATHS.map((path) => ["/", ...path.split("/")]);
|
|
350
|
+
/** A segment built from an expansion ($X, $(...)) can be any name. */
|
|
351
|
+
function isExpansionSegment(segment) {
|
|
352
|
+
return /[$`]/.test(segment);
|
|
353
|
+
}
|
|
354
|
+
function globToRegExp(glob) {
|
|
355
|
+
if (!/[*?[]/.test(glob))
|
|
356
|
+
return undefined;
|
|
357
|
+
let source = "";
|
|
358
|
+
for (let i = 0; i < glob.length; i += 1) {
|
|
359
|
+
const c = glob[i];
|
|
360
|
+
if (c === "*")
|
|
361
|
+
source += ".*";
|
|
362
|
+
else if (c === "?")
|
|
363
|
+
source += ".";
|
|
364
|
+
else if (c === "[") {
|
|
365
|
+
const close = glob.indexOf("]", i + 2);
|
|
366
|
+
if (close === -1)
|
|
367
|
+
source += "\\[";
|
|
368
|
+
else {
|
|
369
|
+
source += `[${glob.slice(i + 1, close).replace(/^!/, "^").replace(/\\/g, "\\\\")}]`;
|
|
370
|
+
i = close;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else
|
|
374
|
+
source += c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
375
|
+
}
|
|
376
|
+
try {
|
|
377
|
+
return new RegExp(`^${source}$`, "i");
|
|
378
|
+
}
|
|
379
|
+
catch {
|
|
380
|
+
// Not a valid pattern (for example an out-of-order range): compare it literally.
|
|
381
|
+
return undefined;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
function segmentMatches(target, pattern) {
|
|
385
|
+
if (isExpansionSegment(target))
|
|
386
|
+
return true;
|
|
387
|
+
const glob = globToRegExp(target);
|
|
388
|
+
if (glob)
|
|
389
|
+
return glob.test(pattern);
|
|
390
|
+
// Case-insensitive, as on the default macOS file system.
|
|
391
|
+
return target.toLowerCase() === pattern.toLowerCase();
|
|
392
|
+
}
|
|
393
|
+
function pathMatches(target, pattern, t = 0, p = 0) {
|
|
394
|
+
if (p === pattern.length)
|
|
395
|
+
return t === target.length;
|
|
396
|
+
if (pattern[p] === "**")
|
|
397
|
+
return true;
|
|
398
|
+
if (t === target.length)
|
|
399
|
+
return false;
|
|
400
|
+
return segmentMatches(target[t], pattern[p]) && pathMatches(target, pattern, t + 1, p + 1);
|
|
401
|
+
}
|
|
402
|
+
/** Appends path segments, applying `.` and `..`. */
|
|
403
|
+
function joinPath(base, segments) {
|
|
404
|
+
const path = [...base];
|
|
405
|
+
for (const segment of segments) {
|
|
406
|
+
if (segment === "" || segment === ".")
|
|
407
|
+
continue;
|
|
408
|
+
if (segment !== "..")
|
|
409
|
+
path.push(segment);
|
|
410
|
+
else if (path.length > 1)
|
|
411
|
+
path.pop();
|
|
412
|
+
// Climbing out of the start directory leads somewhere the guard cannot name.
|
|
413
|
+
else if (path[0] === ".")
|
|
414
|
+
path[0] = "?";
|
|
415
|
+
}
|
|
416
|
+
return path;
|
|
417
|
+
}
|
|
418
|
+
const HOME_SEGMENTS = (() => {
|
|
419
|
+
try {
|
|
420
|
+
return homedir().split("/").filter(Boolean);
|
|
421
|
+
}
|
|
422
|
+
catch {
|
|
423
|
+
return [];
|
|
424
|
+
}
|
|
425
|
+
})();
|
|
426
|
+
/** Rewrites an absolute path inside a home directory to start with HOME. */
|
|
427
|
+
function withHomeMarker(path) {
|
|
428
|
+
if (path[0] !== "/")
|
|
429
|
+
return path;
|
|
430
|
+
const rest = path.slice(1);
|
|
431
|
+
const lower = rest.map((segment) => segment.toLowerCase());
|
|
432
|
+
if (HOME_SEGMENTS.length && HOME_SEGMENTS.every((segment, i) => lower[i] === segment.toLowerCase())) {
|
|
433
|
+
return [...HOME, ...rest.slice(HOME_SEGMENTS.length)];
|
|
434
|
+
}
|
|
435
|
+
if ((lower[0] === "home" || lower[0] === "users") && rest.length >= 2)
|
|
436
|
+
return [...HOME, ...rest.slice(2)];
|
|
437
|
+
if (lower[0] === "root")
|
|
438
|
+
return [...HOME, ...rest.slice(1)];
|
|
439
|
+
if (lower[0] === "var" && lower[1] === "root")
|
|
440
|
+
return [...HOME, ...rest.slice(2)];
|
|
441
|
+
return path;
|
|
442
|
+
}
|
|
443
|
+
/** Resolves a path word (after quote removal) against the current directory. */
|
|
444
|
+
function resolvePath(value, cwd) {
|
|
445
|
+
const home = /^(?:~[^/]*|\$HOME(?![A-Za-z0-9_])|\$\{HOME(?:[:#%/^,@][^}]*)?\})(?=\/|$)/.exec(value);
|
|
446
|
+
if (home)
|
|
447
|
+
return withHomeMarker(joinPath(HOME, value.slice(home[0].length).split("/")));
|
|
448
|
+
if (value.startsWith("/"))
|
|
449
|
+
return withHomeMarker(joinPath(["/"], value.split("/")));
|
|
450
|
+
const segments = value.split("/");
|
|
451
|
+
// A path that starts with an expansion ($DIR/x) is relative to a directory the guard cannot name.
|
|
452
|
+
if (isExpansionSegment(segments[0]))
|
|
453
|
+
return joinPath(["?"], segments.slice(1));
|
|
454
|
+
return withHomeMarker(joinPath(cwd, segments));
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* True when a resolved path is one of the sensitive locations. A path under
|
|
458
|
+
* an unknown directory is compared with the home-directory locations only,
|
|
459
|
+
* since those names (.ssh, .bashrc, ...) rarely appear anywhere else.
|
|
460
|
+
*/
|
|
461
|
+
function isSensitivePath(path) {
|
|
462
|
+
if (path[0] === ".")
|
|
463
|
+
return false;
|
|
464
|
+
if (path[0] === "?")
|
|
465
|
+
return HOME_PATTERNS.some((pattern) => pathMatches([...HOME, ...path.slice(1)], pattern));
|
|
466
|
+
return [...HOME_PATTERNS, ...SYSTEM_PATTERNS].some((pattern) => pathMatches(path, pattern));
|
|
467
|
+
}
|
|
468
|
+
/** Options that take a value, for programs that copy, move, or link files. */
|
|
469
|
+
const COPY_VALUE_OPTIONS = {
|
|
470
|
+
cp: new Set(["-t", "--target-directory", "-S", "--suffix"]),
|
|
471
|
+
mv: new Set(["-t", "--target-directory", "-S", "--suffix"]),
|
|
472
|
+
ln: new Set(["-t", "--target-directory", "-S", "--suffix"]),
|
|
473
|
+
install: new Set(["-t", "--target-directory", "-S", "--suffix", "-m", "--mode", "-o", "--owner", "-g", "--group", "-B", "-f"]),
|
|
474
|
+
};
|
|
475
|
+
/** For cp, mv, ln and install: the destination and the sources. */
|
|
476
|
+
function copyOperands(name, args) {
|
|
477
|
+
const takesValue = COPY_VALUE_OPTIONS[name];
|
|
478
|
+
const operands = [];
|
|
479
|
+
let parents = false;
|
|
480
|
+
let targetDirectory;
|
|
481
|
+
let directoriesOnly = false;
|
|
482
|
+
let ended = false;
|
|
483
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
484
|
+
const arg = args[i];
|
|
485
|
+
if (ended || arg === "-" || !arg.startsWith("-")) {
|
|
486
|
+
operands.push(arg);
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
if (arg === "--") {
|
|
490
|
+
ended = true;
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
const target = longValue(arg, "--target-directory", args, i) ?? (arg === "-t" ? args[i + 1] : /^-t./.test(arg) ? arg.slice(2) : undefined);
|
|
494
|
+
if (target !== undefined)
|
|
495
|
+
targetDirectory = target;
|
|
496
|
+
if (name === "install" && (arg === "-d" || arg === "--directory"))
|
|
497
|
+
directoriesOnly = true;
|
|
498
|
+
if (name === "cp" && arg === "--parents")
|
|
499
|
+
parents = true;
|
|
500
|
+
if (takesValue.has(arg))
|
|
501
|
+
i += 1;
|
|
502
|
+
}
|
|
503
|
+
if (directoriesOnly)
|
|
504
|
+
return { destinations: operands, sources: [], parents };
|
|
505
|
+
if (targetDirectory !== undefined)
|
|
506
|
+
return { destinations: [targetDirectory], sources: operands, parents };
|
|
507
|
+
if (operands.length < 2) {
|
|
508
|
+
return { destinations: name === "ln" ? operands : [], sources: name === "ln" ? [] : operands, parents };
|
|
509
|
+
}
|
|
510
|
+
return { destinations: [operands[operands.length - 1]], sources: operands.slice(0, -1), parents };
|
|
511
|
+
}
|
|
512
|
+
/** Pager commands that only display text: the value of PAGER, GIT_PAGER, core.pager and similar settings. */
|
|
513
|
+
function pagerIsPlain(value) {
|
|
514
|
+
const words = value.trim().split(/\s+/).filter(Boolean);
|
|
515
|
+
if (!words.length)
|
|
516
|
+
return true;
|
|
517
|
+
// Bare names from PATH; less options that neither take a value nor write a file.
|
|
518
|
+
return ["cat", "less", "more", "most", "true", "false", ":"].includes(words[0]) &&
|
|
519
|
+
words.slice(1).every((word) => /^-[RrFXSsiIMmNnEeKwWJ]+$/.test(word));
|
|
520
|
+
}
|
|
521
|
+
/** Environment variables whose value is used as a pager. */
|
|
522
|
+
const PAGER_ENV_VARS = new Set(["GIT_PAGER", "PAGER", "MANPAGER"]);
|
|
314
523
|
class Analysis {
|
|
315
524
|
source;
|
|
316
525
|
constructor(source) {
|
|
317
526
|
this.source = source;
|
|
318
527
|
}
|
|
528
|
+
/**
|
|
529
|
+
* Every directory the current command may run in. A `cd` adds its target
|
|
530
|
+
* rather than replacing the set, because it may be skipped (`a || cd x`)
|
|
531
|
+
* or fail.
|
|
532
|
+
*/
|
|
533
|
+
cwds = [START];
|
|
319
534
|
/** Source text of the arguments of the program currently being checked, when known. */
|
|
320
535
|
currentRawArgs;
|
|
321
536
|
findings = new Set();
|
|
@@ -326,16 +541,25 @@ class Analysis {
|
|
|
326
541
|
add(id) {
|
|
327
542
|
this.findings.add(id);
|
|
328
543
|
}
|
|
329
|
-
/**
|
|
330
|
-
|
|
544
|
+
/**
|
|
545
|
+
* Parses a string the shell would run as a command line and checks it.
|
|
546
|
+
* It runs in a child process unless `sameShell` is set (eval), so its `cd`
|
|
547
|
+
* commands do not change the directory of later commands.
|
|
548
|
+
*/
|
|
549
|
+
nestedScript(text, depth, sameShell = false) {
|
|
331
550
|
this.allTextOnly = false;
|
|
332
551
|
this.extraTexts.push(text);
|
|
552
|
+
const cwds = this.cwds;
|
|
333
553
|
try {
|
|
334
554
|
this.script(parseShell(text, 0, depth), depth, false);
|
|
335
555
|
}
|
|
336
556
|
catch (error) {
|
|
337
557
|
this.add(parseFailureRule(error));
|
|
338
558
|
}
|
|
559
|
+
finally {
|
|
560
|
+
if (!sameShell)
|
|
561
|
+
this.cwds = cwds;
|
|
562
|
+
}
|
|
339
563
|
}
|
|
340
564
|
script(script, depth, topLevel) {
|
|
341
565
|
const names = new Set();
|
|
@@ -347,8 +571,28 @@ class Analysis {
|
|
|
347
571
|
}
|
|
348
572
|
}
|
|
349
573
|
}
|
|
574
|
+
// A `cd` inside a `( ... )` subshell does not change the directory outside it.
|
|
575
|
+
let open = [];
|
|
576
|
+
const cwdsOutside = [];
|
|
350
577
|
for (const pipeline of script.pipelines) {
|
|
351
|
-
|
|
578
|
+
let shared = 0;
|
|
579
|
+
while (shared < open.length && open[shared] === pipeline.subshells[shared])
|
|
580
|
+
shared += 1;
|
|
581
|
+
if (shared < open.length)
|
|
582
|
+
this.cwds = cwdsOutside[shared];
|
|
583
|
+
cwdsOutside.length = shared;
|
|
584
|
+
for (let i = shared; i < pipeline.subshells.length; i += 1)
|
|
585
|
+
cwdsOutside[i] = this.cwds;
|
|
586
|
+
open = pipeline.subshells;
|
|
587
|
+
// Each stage of a multi-command pipeline runs in its own subshell.
|
|
588
|
+
const before = this.cwds;
|
|
589
|
+
const isolated = pipeline.commands.length > 1;
|
|
590
|
+
const pipelineNames = pipeline.commands.map((command) => {
|
|
591
|
+
const stageNames = this.command(command, depth, topLevel);
|
|
592
|
+
if (isolated)
|
|
593
|
+
this.cwds = before;
|
|
594
|
+
return stageNames;
|
|
595
|
+
});
|
|
352
596
|
pipelineNames.forEach((set) => set.forEach((name) => names.add(name)));
|
|
353
597
|
// A download piped into a shell later in the same pipeline.
|
|
354
598
|
const fetchAt = pipelineNames.findIndex((set) => [...set].some((name) => FETCHERS.has(name)));
|
|
@@ -358,6 +602,16 @@ class Analysis {
|
|
|
358
602
|
}
|
|
359
603
|
return names;
|
|
360
604
|
}
|
|
605
|
+
/** Checks a command or process substitution, which runs in its own subshell. */
|
|
606
|
+
substitution(sub, depth) {
|
|
607
|
+
const cwds = this.cwds;
|
|
608
|
+
try {
|
|
609
|
+
return this.script(sub, depth + 1, false);
|
|
610
|
+
}
|
|
611
|
+
finally {
|
|
612
|
+
this.cwds = cwds;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
361
615
|
/** Checks one simple command. Returns the names of the programs it runs (including nested ones). */
|
|
362
616
|
command(command, depth, topLevel) {
|
|
363
617
|
const names = new Set();
|
|
@@ -365,7 +619,7 @@ class Analysis {
|
|
|
365
619
|
for (const word of command.words) {
|
|
366
620
|
let fetches = false;
|
|
367
621
|
for (const sub of word.substitutions) {
|
|
368
|
-
const inner = this.
|
|
622
|
+
const inner = this.substitution(sub, depth);
|
|
369
623
|
inner.forEach((name) => names.add(name));
|
|
370
624
|
if ([...inner].some((name) => FETCHERS.has(name)))
|
|
371
625
|
fetches = true;
|
|
@@ -375,7 +629,7 @@ class Analysis {
|
|
|
375
629
|
let redirectFetches = false;
|
|
376
630
|
for (const redirect of command.redirects) {
|
|
377
631
|
for (const sub of [...(redirect.target?.substitutions ?? []), ...(redirect.heredoc?.substitutions ?? [])]) {
|
|
378
|
-
const inner = this.
|
|
632
|
+
const inner = this.substitution(sub, depth);
|
|
379
633
|
inner.forEach((name) => names.add(name));
|
|
380
634
|
if ([...inner].some((name) => FETCHERS.has(name)))
|
|
381
635
|
redirectFetches = true;
|
|
@@ -427,9 +681,38 @@ class Analysis {
|
|
|
427
681
|
}
|
|
428
682
|
redirect(redirect) {
|
|
429
683
|
const target = redirect.target?.value;
|
|
430
|
-
if (target
|
|
684
|
+
if (!target || !/>/.test(redirect.op))
|
|
685
|
+
return;
|
|
686
|
+
// `>&2`, `2>&1` and `>&-` duplicate or close a descriptor; `>(...)` is checked as a command.
|
|
687
|
+
if (/&/.test(redirect.op) && /^(?:\d+-?|-)$/.test(target))
|
|
688
|
+
return;
|
|
689
|
+
if (/^[<>]\(/.test(target))
|
|
690
|
+
return;
|
|
691
|
+
if (target.startsWith("/dev/") && !SAFE_DEVICE.test(target))
|
|
431
692
|
this.add("storage.raw-device-write");
|
|
432
|
-
|
|
693
|
+
this.writeTarget(target);
|
|
694
|
+
}
|
|
695
|
+
/** Records a write to a file at `target`, a word after quote removal. */
|
|
696
|
+
writeTarget(target) {
|
|
697
|
+
if (this.cwds.some((cwd) => isSensitivePath(resolvePath(target, cwd))))
|
|
698
|
+
this.add("filesystem.sensitive-path-write");
|
|
699
|
+
}
|
|
700
|
+
/** Follows `cd`, so later relative paths also resolve against the new directory. */
|
|
701
|
+
changeDirectory(name, args) {
|
|
702
|
+
const operand = name === "popd" ? "-" : splitOptions(args).operands[0];
|
|
703
|
+
let added;
|
|
704
|
+
if (operand === undefined)
|
|
705
|
+
added = name === "cd" ? [HOME] : [];
|
|
706
|
+
else if (operand === "-" || /^[+-]\d+$/.test(operand))
|
|
707
|
+
added = [["?"]];
|
|
708
|
+
else
|
|
709
|
+
added = this.cwds.map((cwd) => resolvePath(operand, cwd));
|
|
710
|
+
const next = [...this.cwds];
|
|
711
|
+
for (const path of added)
|
|
712
|
+
if (!next.some((known) => known.join("/") === path.join("/")))
|
|
713
|
+
next.push(path);
|
|
714
|
+
// Past a handful of possibilities, an unknown directory stands for the rest.
|
|
715
|
+
this.cwds = next.length > MAX_CWDS ? [...next.slice(0, MAX_CWDS), ["?"]] : next;
|
|
433
716
|
}
|
|
434
717
|
/**
|
|
435
718
|
* Unwraps wrappers (sudo, env, xargs, find -exec, sh -c, ...) and applies
|
|
@@ -494,7 +777,7 @@ class Analysis {
|
|
|
494
777
|
return { names, runner: name, textOnly: false, scriptWords: args.length ? [offset] : [], readsStdin: false };
|
|
495
778
|
}
|
|
496
779
|
if (name === "eval") {
|
|
497
|
-
this.nestedScript(args.join(" "), depth + 1);
|
|
780
|
+
this.nestedScript(args.join(" "), depth + 1, true);
|
|
498
781
|
return { names, runner: name, textOnly: false, scriptWords: args.map((_, i) => offset + i), readsStdin: false };
|
|
499
782
|
}
|
|
500
783
|
this.currentRawArgs = raws?.slice(offset);
|
|
@@ -528,6 +811,9 @@ class Analysis {
|
|
|
528
811
|
}
|
|
529
812
|
if (COMMAND_ENV_VARS.has(name)) {
|
|
530
813
|
this.nestedScript(value, depth + 1);
|
|
814
|
+
// A pager runs whenever output is paged; like `git -c core.pager`, only plain pagers are allowed.
|
|
815
|
+
if (PAGER_ENV_VARS.has(name) && !pagerIsPlain(value))
|
|
816
|
+
this.add("shell.program-launcher-option");
|
|
531
817
|
return true;
|
|
532
818
|
}
|
|
533
819
|
return false;
|
|
@@ -770,6 +1056,38 @@ class Analysis {
|
|
|
770
1056
|
if (args.some((arg) => /^of=\/dev\//i.test(arg) && !SAFE_DEVICE.test(arg.slice(3)))) {
|
|
771
1057
|
this.add("storage.raw-device-write");
|
|
772
1058
|
}
|
|
1059
|
+
for (const arg of args)
|
|
1060
|
+
if (/^of=/i.test(arg))
|
|
1061
|
+
this.writeTarget(arg.slice(3));
|
|
1062
|
+
return;
|
|
1063
|
+
case "tee":
|
|
1064
|
+
for (const operand of operands)
|
|
1065
|
+
this.writeTarget(operand);
|
|
1066
|
+
return;
|
|
1067
|
+
case "cp":
|
|
1068
|
+
case "mv":
|
|
1069
|
+
case "install":
|
|
1070
|
+
case "ln": {
|
|
1071
|
+
const { destinations, sources, parents } = copyOperands(name, args);
|
|
1072
|
+
for (const destination of destinations) {
|
|
1073
|
+
this.writeTarget(destination);
|
|
1074
|
+
// The destination may be a directory: each source then lands inside it under its own
|
|
1075
|
+
// name, or under its whole path with `cp --parents`.
|
|
1076
|
+
for (const source of sources) {
|
|
1077
|
+
const kept = parents ? source.replace(/^\/+/, "") : source.split("/").filter(Boolean).pop() ?? "";
|
|
1078
|
+
this.writeTarget(`${destination}/${kept}`);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
// A link to a sensitive file lets a later write reach it.
|
|
1082
|
+
if (name === "ln")
|
|
1083
|
+
for (const source of sources)
|
|
1084
|
+
this.writeTarget(source);
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
case "cd":
|
|
1088
|
+
case "pushd":
|
|
1089
|
+
case "popd":
|
|
1090
|
+
this.changeDirectory(name, args);
|
|
773
1091
|
return;
|
|
774
1092
|
case "wipefs":
|
|
775
1093
|
this.add("storage.raw-device-write");
|
|
@@ -885,6 +1203,9 @@ class Analysis {
|
|
|
885
1203
|
const parsed = parseGit(args);
|
|
886
1204
|
if (parsed.launcher)
|
|
887
1205
|
this.add("shell.program-launcher-option");
|
|
1206
|
+
// Check pager and editor commands given with -c, so their own rules apply too.
|
|
1207
|
+
for (const value of parsed.configCommands)
|
|
1208
|
+
this.nestedScript(value, depth + 1);
|
|
888
1209
|
const sub = parsed.subcommand;
|
|
889
1210
|
const rest = parsed.rest;
|
|
890
1211
|
const { options, operands } = splitOptions(rest);
|
|
@@ -1023,17 +1344,24 @@ function skipOptions(args, takesValue) {
|
|
|
1023
1344
|
/** Splits `git [global options] <subcommand> [args]` and flags global options that run programs. */
|
|
1024
1345
|
function parseGit(args) {
|
|
1025
1346
|
let launcher = false;
|
|
1347
|
+
const configCommands = [];
|
|
1348
|
+
const config = (pair) => {
|
|
1349
|
+
if (!gitConfigPairIsSafe(pair))
|
|
1350
|
+
launcher = true;
|
|
1351
|
+
const eq = pair.indexOf("=");
|
|
1352
|
+
if (eq !== -1 && /^(?:core\.(?:pager|editor)|pager\..+|sequence\.editor)$/i.test(pair.slice(0, eq))) {
|
|
1353
|
+
configCommands.push(pair.slice(eq + 1));
|
|
1354
|
+
}
|
|
1355
|
+
};
|
|
1026
1356
|
let i = 0;
|
|
1027
1357
|
while (i < args.length) {
|
|
1028
1358
|
const arg = args[i];
|
|
1029
1359
|
if (arg === "-c") {
|
|
1030
|
-
|
|
1031
|
-
launcher = true;
|
|
1360
|
+
config(args[i + 1] ?? "");
|
|
1032
1361
|
i += 2;
|
|
1033
1362
|
}
|
|
1034
1363
|
else if (arg.startsWith("-c") && arg.length > 2) {
|
|
1035
|
-
|
|
1036
|
-
launcher = true;
|
|
1364
|
+
config(arg.slice(2));
|
|
1037
1365
|
i += 1;
|
|
1038
1366
|
}
|
|
1039
1367
|
else if (arg === "--config-env" || arg.startsWith("--config-env=")) {
|
|
@@ -1054,11 +1382,17 @@ function parseGit(args) {
|
|
|
1054
1382
|
break;
|
|
1055
1383
|
}
|
|
1056
1384
|
}
|
|
1057
|
-
return { subcommand: args[i]?.toLowerCase(), rest: args.slice(i + 1), launcher };
|
|
1385
|
+
return { subcommand: args[i]?.toLowerCase(), rest: args.slice(i + 1), launcher, configCommands };
|
|
1058
1386
|
}
|
|
1059
1387
|
function gitConfigPairIsSafe(pair) {
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1388
|
+
const eq = pair.indexOf("=");
|
|
1389
|
+
const key = (eq === -1 ? pair : pair.slice(0, eq)).toLowerCase();
|
|
1390
|
+
if (GIT_SAFE_CONFIG_KEY.test(key))
|
|
1391
|
+
return true;
|
|
1392
|
+
// A pager setting is safe when it names a plain pager (or turns paging on or off).
|
|
1393
|
+
if (eq !== -1 && (key === "core.pager" || /^pager\.[a-z0-9-]+$/.test(key)))
|
|
1394
|
+
return pagerIsPlain(pair.slice(eq + 1));
|
|
1395
|
+
return false;
|
|
1062
1396
|
}
|
|
1063
1397
|
/** Blanks out the given [start, end) spans, keeping newlines so line structure is preserved. */
|
|
1064
1398
|
function maskSpans(text, spans) {
|