@orbit-build/cli 1.6.6 → 1.6.7
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 +224 -39
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -247529,6 +247529,7 @@ import { createHash as createHash5, createPublicKey as createPublicKey3, verify
|
|
|
247529
247529
|
import { existsSync as existsSync33, lstatSync as lstatSync32, readFileSync as readFileSync2 } from "fs";
|
|
247530
247530
|
import { dirname as dirname22, resolve as resolve23, win32 } from "path";
|
|
247531
247531
|
import { z as z24 } from "zod";
|
|
247532
|
+
import { posix } from "path";
|
|
247532
247533
|
var SafePathSegmentSchema = z13.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/);
|
|
247533
247534
|
var CheckpointIdSchema = z13.string().regex(/^cp_[a-f0-9]{32}$/);
|
|
247534
247535
|
var PersistedCheckpointMetadataSchema = z13.object({
|
|
@@ -248300,6 +248301,200 @@ function isSensitiveSnapshotPath(filePath) {
|
|
|
248300
248301
|
function toErrorMessage2(error) {
|
|
248301
248302
|
return error instanceof Error ? error.message : String(error);
|
|
248302
248303
|
}
|
|
248304
|
+
var MACOS_RUNTIME_BASE_POLICY = String.raw`
|
|
248305
|
+
(version 1)
|
|
248306
|
+
(deny default)
|
|
248307
|
+
|
|
248308
|
+
(allow process-exec)
|
|
248309
|
+
(allow process-fork)
|
|
248310
|
+
(allow signal (target same-sandbox))
|
|
248311
|
+
(allow process-info* (target same-sandbox))
|
|
248312
|
+
|
|
248313
|
+
(allow sysctl-read)
|
|
248314
|
+
(allow sysctl-write (sysctl-name "kern.grade_cputype"))
|
|
248315
|
+
(allow system-mac-syscall (mac-policy-name "vnguard"))
|
|
248316
|
+
(allow system-mac-syscall
|
|
248317
|
+
(require-all
|
|
248318
|
+
(mac-policy-name "Sandbox")
|
|
248319
|
+
(mac-syscall-number 67)))
|
|
248320
|
+
|
|
248321
|
+
(allow iokit-open
|
|
248322
|
+
(iokit-registry-entry-class "RootDomainUserClient"))
|
|
248323
|
+
|
|
248324
|
+
(allow ipc-posix-sem)
|
|
248325
|
+
(allow ipc-posix-shm-read-data
|
|
248326
|
+
ipc-posix-shm-write-create
|
|
248327
|
+
ipc-posix-shm-write-unlink
|
|
248328
|
+
(ipc-posix-name-regex #"^/__KMP_REGISTERED_LIB_[0-9]+$"))
|
|
248329
|
+
(allow ipc-posix-shm-read*
|
|
248330
|
+
(ipc-posix-name-prefix "apple.cfprefs."))
|
|
248331
|
+
(allow ipc-posix-shm-read*
|
|
248332
|
+
(ipc-posix-name "apple.shm.notification_center"))
|
|
248333
|
+
|
|
248334
|
+
(allow mach-lookup
|
|
248335
|
+
(global-name "com.apple.PowerManagement.control")
|
|
248336
|
+
(global-name "com.apple.analyticsd")
|
|
248337
|
+
(global-name "com.apple.analyticsd.messagetracer")
|
|
248338
|
+
(global-name "com.apple.appsleep")
|
|
248339
|
+
(global-name "com.apple.bsd.dirhelper")
|
|
248340
|
+
(global-name "com.apple.cfprefsd.agent")
|
|
248341
|
+
(global-name "com.apple.cfprefsd.daemon")
|
|
248342
|
+
(global-name "com.apple.diagnosticd")
|
|
248343
|
+
(global-name "com.apple.dt.automationmode.reader")
|
|
248344
|
+
(global-name "com.apple.espd")
|
|
248345
|
+
(global-name "com.apple.logd")
|
|
248346
|
+
(global-name "com.apple.logd.events")
|
|
248347
|
+
(global-name "com.apple.runningboard")
|
|
248348
|
+
(global-name "com.apple.secinitd")
|
|
248349
|
+
(global-name "com.apple.system.DirectoryService.libinfo_v1")
|
|
248350
|
+
(global-name "com.apple.system.logger")
|
|
248351
|
+
(global-name "com.apple.system.notification_center")
|
|
248352
|
+
(global-name "com.apple.system.opendirectoryd.libinfo")
|
|
248353
|
+
(global-name "com.apple.system.opendirectoryd.membership")
|
|
248354
|
+
(global-name "com.apple.trustd")
|
|
248355
|
+
(global-name "com.apple.trustd.agent")
|
|
248356
|
+
(global-name "com.apple.xpc.activity.unmanaged")
|
|
248357
|
+
(local-name "com.apple.cfprefsd.agent"))
|
|
248358
|
+
(allow user-preference-read)
|
|
248359
|
+
|
|
248360
|
+
(allow pseudo-tty)
|
|
248361
|
+
(allow file-read* file-write* file-ioctl (literal "/dev/ptmx"))
|
|
248362
|
+
(allow file-read* file-write*
|
|
248363
|
+
(require-all
|
|
248364
|
+
(regex #"^/dev/ttys[0-9]+")
|
|
248365
|
+
(extension "com.apple.sandbox.pty")))
|
|
248366
|
+
(allow file-ioctl (regex #"^/dev/ttys[0-9]+"))
|
|
248367
|
+
`;
|
|
248368
|
+
var MACOS_PLATFORM_FILESYSTEM_POLICY = String.raw`
|
|
248369
|
+
(allow file-read* file-test-existence
|
|
248370
|
+
(subpath "/Library/Apple")
|
|
248371
|
+
(subpath "/Library/Filesystems/NetFSPlugins")
|
|
248372
|
+
(subpath "/Library/Preferences")
|
|
248373
|
+
(subpath "/Library/Preferences/Logging")
|
|
248374
|
+
(subpath "/private/var/db")
|
|
248375
|
+
(subpath "/usr/lib")
|
|
248376
|
+
(subpath "/usr/share")
|
|
248377
|
+
(subpath "/var/db"))
|
|
248378
|
+
|
|
248379
|
+
(allow file-map-executable
|
|
248380
|
+
(subpath "/Library/Apple/System/Library/Frameworks")
|
|
248381
|
+
(subpath "/Library/Apple/System/Library/PrivateFrameworks")
|
|
248382
|
+
(subpath "/Library/Apple/usr/lib")
|
|
248383
|
+
(subpath "/System/Library/Extensions")
|
|
248384
|
+
(subpath "/System/Library/Frameworks")
|
|
248385
|
+
(subpath "/System/Library/PrivateFrameworks")
|
|
248386
|
+
(subpath "/System/Library/SubFrameworks")
|
|
248387
|
+
(subpath "/System/iOSSupport/System/Library/Frameworks")
|
|
248388
|
+
(subpath "/System/iOSSupport/System/Library/PrivateFrameworks")
|
|
248389
|
+
(subpath "/System/iOSSupport/System/Library/SubFrameworks")
|
|
248390
|
+
(subpath "/usr/lib"))
|
|
248391
|
+
|
|
248392
|
+
(allow file-read-metadata file-test-existence
|
|
248393
|
+
(literal "/etc")
|
|
248394
|
+
(literal "/tmp")
|
|
248395
|
+
(literal "/var")
|
|
248396
|
+
(literal "/private/etc/localtime"))
|
|
248397
|
+
(allow file-read-metadata file-test-existence
|
|
248398
|
+
(path-ancestors "/System/Volumes/Data/private"))
|
|
248399
|
+
(allow file-read* file-test-existence (literal "/"))
|
|
248400
|
+
|
|
248401
|
+
(allow file-read* file-test-existence
|
|
248402
|
+
(literal "/dev/autofs_nowait")
|
|
248403
|
+
(literal "/dev/random")
|
|
248404
|
+
(literal "/dev/urandom")
|
|
248405
|
+
(literal "/private/etc/master.passwd")
|
|
248406
|
+
(literal "/private/etc/passwd")
|
|
248407
|
+
(literal "/private/etc/protocols")
|
|
248408
|
+
(literal "/private/etc/services"))
|
|
248409
|
+
(allow file-read* file-test-existence file-write-data
|
|
248410
|
+
(literal "/dev/null")
|
|
248411
|
+
(literal "/dev/zero"))
|
|
248412
|
+
(allow file-read-data file-test-existence file-write-data
|
|
248413
|
+
(subpath "/dev/fd"))
|
|
248414
|
+
(allow file-read* file-test-existence file-write-data file-ioctl
|
|
248415
|
+
(literal "/dev/dtracehelper"))
|
|
248416
|
+
|
|
248417
|
+
(allow file-read* file-test-existence file-write* (subpath "/tmp"))
|
|
248418
|
+
(allow file-read* file-test-existence file-write* (subpath "/private/tmp"))
|
|
248419
|
+
(allow file-read* file-test-existence file-write* (subpath "/var/tmp"))
|
|
248420
|
+
(allow file-read* file-test-existence file-write* (subpath "/private/var/tmp"))
|
|
248421
|
+
|
|
248422
|
+
(allow file-read* (subpath "/etc"))
|
|
248423
|
+
(allow file-read* (subpath "/private/etc"))
|
|
248424
|
+
(allow file-read-metadata (subpath "/var"))
|
|
248425
|
+
(allow file-read-metadata (subpath "/private/var"))
|
|
248426
|
+
|
|
248427
|
+
(allow file-read-data file-read-metadata (subpath "/bin"))
|
|
248428
|
+
(allow file-read-data file-read-metadata (subpath "/sbin"))
|
|
248429
|
+
(allow file-read-data file-read-metadata (subpath "/usr/bin"))
|
|
248430
|
+
(allow file-read-data file-read-metadata (subpath "/usr/sbin"))
|
|
248431
|
+
(allow file-read-data file-read-metadata (subpath "/usr/libexec"))
|
|
248432
|
+
(allow file-read* (subpath "/opt/homebrew/lib"))
|
|
248433
|
+
(allow file-read* (subpath "/usr/local/lib"))
|
|
248434
|
+
|
|
248435
|
+
(allow file-read* (regex #"^/dev/fd/(0|1|2)$"))
|
|
248436
|
+
(allow file-write* (regex #"^/dev/fd/(1|2)$"))
|
|
248437
|
+
(allow file-read* file-write* (literal "/dev/tty"))
|
|
248438
|
+
(allow file-read-metadata (literal "/dev"))
|
|
248439
|
+
(allow file-read-metadata (regex #"^/dev/.*$"))
|
|
248440
|
+
(allow file-read-metadata (literal "/dev/stdin"))
|
|
248441
|
+
(allow file-read-metadata (literal "/dev/stdout"))
|
|
248442
|
+
(allow file-read-metadata (literal "/dev/stderr"))
|
|
248443
|
+
(allow file-read-metadata (regex #"^/dev/tty[^/]*$"))
|
|
248444
|
+
(allow file-read-metadata (regex #"^/dev/pty[^/]*$"))
|
|
248445
|
+
|
|
248446
|
+
(allow file-read-metadata (literal "/System/Volumes") (vnode-type DIRECTORY))
|
|
248447
|
+
(allow file-read-metadata (literal "/System/Volumes/Data") (vnode-type DIRECTORY))
|
|
248448
|
+
(allow file-read-metadata (literal "/System/Volumes/Data/Users") (vnode-type DIRECTORY))
|
|
248449
|
+
|
|
248450
|
+
(allow file-read* (extension "com.apple.app-sandbox.read"))
|
|
248451
|
+
(allow file-read* file-write* (extension "com.apple.app-sandbox.read-write"))
|
|
248452
|
+
`;
|
|
248453
|
+
var SYSTEM_READABLE_ROOTS = ["/System", "/usr", "/bin", "/sbin", "/dev"];
|
|
248454
|
+
function createMacOsSeatbeltProfile(options) {
|
|
248455
|
+
const runtimeRoots = macOsRuntimeReadOnlyRoots(
|
|
248456
|
+
options.invocation.file,
|
|
248457
|
+
options.environment
|
|
248458
|
+
);
|
|
248459
|
+
const readableRoots = /* @__PURE__ */ new Set([
|
|
248460
|
+
...SYSTEM_READABLE_ROOTS,
|
|
248461
|
+
options.cwd,
|
|
248462
|
+
...options.writableRoots,
|
|
248463
|
+
...options.readOnlyRoots,
|
|
248464
|
+
...runtimeRoots
|
|
248465
|
+
]);
|
|
248466
|
+
const lines = [
|
|
248467
|
+
MACOS_RUNTIME_BASE_POLICY.trim(),
|
|
248468
|
+
MACOS_PLATFORM_FILESYSTEM_POLICY.trim(),
|
|
248469
|
+
options.network === "deny" ? "(deny network*)" : "(allow network*)"
|
|
248470
|
+
];
|
|
248471
|
+
for (const root of readableRoots) {
|
|
248472
|
+
const value = profileString(root);
|
|
248473
|
+
lines.push(
|
|
248474
|
+
`(allow file-read* file-test-existence (subpath ${value}))`,
|
|
248475
|
+
`(allow file-read-metadata file-test-existence (path-ancestors ${value}))`
|
|
248476
|
+
);
|
|
248477
|
+
}
|
|
248478
|
+
for (const root of runtimeRoots) {
|
|
248479
|
+
lines.push(`(allow file-map-executable (subpath ${profileString(root)}))`);
|
|
248480
|
+
}
|
|
248481
|
+
for (const root of options.writableRoots) {
|
|
248482
|
+
lines.push(`(allow file-write* (subpath ${profileString(root)}))`);
|
|
248483
|
+
}
|
|
248484
|
+
return lines.join("\n");
|
|
248485
|
+
}
|
|
248486
|
+
function macOsRuntimeReadOnlyRoots(command, environment) {
|
|
248487
|
+
const roots = [];
|
|
248488
|
+
if (posix.isAbsolute(command)) roots.push(posix.dirname(command));
|
|
248489
|
+
for (const candidate of (environment.PATH ?? "").split(":")) {
|
|
248490
|
+
if (!candidate || !posix.isAbsolute(candidate)) continue;
|
|
248491
|
+
if (!roots.includes(candidate)) roots.push(candidate);
|
|
248492
|
+
}
|
|
248493
|
+
return roots;
|
|
248494
|
+
}
|
|
248495
|
+
function profileString(value) {
|
|
248496
|
+
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
|
248497
|
+
}
|
|
248303
248498
|
var ProcessSandboxModeSchema = z24.enum(["off", "auto", "required"]);
|
|
248304
248499
|
var ProcessSandboxNetworkSchema = z24.enum(["inherit", "deny", "allow"]);
|
|
248305
248500
|
var ProcessSandboxBackendSchema = z24.enum([
|
|
@@ -248420,15 +248615,17 @@ function sandboxInvocation(invocation, request) {
|
|
|
248420
248615
|
const selected = capabilities.selectedBackend;
|
|
248421
248616
|
if (selected === "macos-sandbox-exec") {
|
|
248422
248617
|
const executable2 = request.environment?.ORBIT_SANDBOX_EXEC_PATH ?? "/usr/bin/sandbox-exec";
|
|
248423
|
-
const profile =
|
|
248618
|
+
const profile = createMacOsSeatbeltProfile({
|
|
248619
|
+
invocation,
|
|
248424
248620
|
cwd,
|
|
248425
248621
|
writableRoots,
|
|
248426
248622
|
readOnlyRoots,
|
|
248427
|
-
network
|
|
248428
|
-
|
|
248623
|
+
network,
|
|
248624
|
+
environment: request.environment ?? process.env
|
|
248625
|
+
});
|
|
248429
248626
|
return {
|
|
248430
248627
|
file: executable2,
|
|
248431
|
-
args: ["-p", profile, invocation.file, ...invocation.args],
|
|
248628
|
+
args: ["-p", profile, "--", invocation.file, ...invocation.args],
|
|
248432
248629
|
backend: selected,
|
|
248433
248630
|
networkIsolation: network === "deny",
|
|
248434
248631
|
degraded: false
|
|
@@ -248576,32 +248773,6 @@ function verifyWindowsSandboxHelper(options) {
|
|
|
248576
248773
|
return void 0;
|
|
248577
248774
|
}
|
|
248578
248775
|
}
|
|
248579
|
-
function createMacOsProfile(cwd, writableRoots, readOnlyRoots, network) {
|
|
248580
|
-
const readable2 = [
|
|
248581
|
-
"/System",
|
|
248582
|
-
"/usr",
|
|
248583
|
-
"/bin",
|
|
248584
|
-
"/sbin",
|
|
248585
|
-
"/private/tmp",
|
|
248586
|
-
"/dev",
|
|
248587
|
-
cwd,
|
|
248588
|
-
...writableRoots,
|
|
248589
|
-
...readOnlyRoots
|
|
248590
|
-
];
|
|
248591
|
-
const lines = ["(version 1)", "(deny default)", "(allow process*)"];
|
|
248592
|
-
if (network === "deny") {
|
|
248593
|
-
lines.push("(deny network*)");
|
|
248594
|
-
} else {
|
|
248595
|
-
lines.push("(allow network*)");
|
|
248596
|
-
}
|
|
248597
|
-
for (const root of new Set(readable2)) {
|
|
248598
|
-
lines.push(`(allow file-read* (subpath ${profileString(root)}))`);
|
|
248599
|
-
}
|
|
248600
|
-
for (const root of writableRoots) {
|
|
248601
|
-
lines.push(`(allow file-write* (subpath ${profileString(root)}))`);
|
|
248602
|
-
}
|
|
248603
|
-
return lines.join(" ");
|
|
248604
|
-
}
|
|
248605
248776
|
function createBubblewrapArgs(invocation, cwd, writableRoots, readOnlyRoots, network) {
|
|
248606
248777
|
const args = [
|
|
248607
248778
|
"--die-with-parent",
|
|
@@ -248637,9 +248808,6 @@ function runtimeReadOnlyRoots(command) {
|
|
|
248637
248808
|
}
|
|
248638
248809
|
return roots;
|
|
248639
248810
|
}
|
|
248640
|
-
function profileString(value) {
|
|
248641
|
-
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
|
248642
|
-
}
|
|
248643
248811
|
|
|
248644
248812
|
// src/runtime/CacheDiagnostics.ts
|
|
248645
248813
|
import { existsSync as existsSync13, readdirSync as readdirSync7 } from "fs";
|
|
@@ -253124,13 +253292,26 @@ var PROCESS_OUTPUT_MAX_BYTES = 8 * 1024 * 1024;
|
|
|
253124
253292
|
function safeProcessFailureMessage(message2) {
|
|
253125
253293
|
return redactSecrets(message2).replace(/[\r\n]+/g, " ").slice(0, 2e3);
|
|
253126
253294
|
}
|
|
253127
|
-
function readProcessFailureMessage(result) {
|
|
253295
|
+
function readProcessFailureMessage(result, context = {}) {
|
|
253296
|
+
const message2 = rawProcessFailureMessage(result);
|
|
253297
|
+
if (context.sandboxBackend === "macos-sandbox-exec" && message2.includes("sandbox-exec -p")) {
|
|
253298
|
+
const signal = message2.match(/\bSIG[A-Z0-9]+\b/)?.[0];
|
|
253299
|
+
return signal ? `The macOS sandboxed process was terminated by ${signal}.` : "The macOS sandboxed process failed before command completion.";
|
|
253300
|
+
}
|
|
253301
|
+
return safeProcessFailureMessage(message2);
|
|
253302
|
+
}
|
|
253303
|
+
function processOutputLimitExceeded(result) {
|
|
253304
|
+
if (typeof result !== "object" || result === null) return false;
|
|
253305
|
+
const record2 = result;
|
|
253306
|
+
return record2.isMaxBuffer === true || /maxBuffer exceeded/i.test(rawProcessFailureMessage(result));
|
|
253307
|
+
}
|
|
253308
|
+
function rawProcessFailureMessage(result) {
|
|
253128
253309
|
if (typeof result !== "object" || result === null) {
|
|
253129
253310
|
return "The child process failed.";
|
|
253130
253311
|
}
|
|
253131
253312
|
const record2 = result;
|
|
253132
253313
|
const message2 = typeof record2.shortMessage === "string" ? record2.shortMessage : typeof record2.message === "string" ? record2.message : "The child process failed.";
|
|
253133
|
-
return
|
|
253314
|
+
return message2;
|
|
253134
253315
|
}
|
|
253135
253316
|
function firstExistingPath(candidates, pathExists = existsSync7) {
|
|
253136
253317
|
for (const candidate of candidates) {
|
|
@@ -253292,8 +253473,10 @@ var BashTool = class {
|
|
|
253292
253473
|
error: "Command execution was interrupted by the user."
|
|
253293
253474
|
};
|
|
253294
253475
|
}
|
|
253295
|
-
const failureMessage = readProcessFailureMessage(result
|
|
253296
|
-
|
|
253476
|
+
const failureMessage = readProcessFailureMessage(result, {
|
|
253477
|
+
sandboxBackend: sandboxed.backend
|
|
253478
|
+
});
|
|
253479
|
+
const outputLimitExceeded = result.failed && processOutputLimitExceeded(result);
|
|
253297
253480
|
const exitCode = result.exitCode ?? (result.failed ? 1 : 0);
|
|
253298
253481
|
const displayStdout = redactSecrets(
|
|
253299
253482
|
LogTruncator.truncate(stdout2, 150, 2e4)
|
|
@@ -253465,8 +253648,10 @@ var RunTestsTool = class {
|
|
|
253465
253648
|
error: "Test execution was interrupted by the user."
|
|
253466
253649
|
};
|
|
253467
253650
|
}
|
|
253468
|
-
const failureMessage = readProcessFailureMessage(result
|
|
253469
|
-
|
|
253651
|
+
const failureMessage = readProcessFailureMessage(result, {
|
|
253652
|
+
sandboxBackend: sandboxed.backend
|
|
253653
|
+
});
|
|
253654
|
+
const outputLimitExceeded = result.failed && processOutputLimitExceeded(result);
|
|
253470
253655
|
const exitCode = result.exitCode ?? (result.failed ? 1 : 0);
|
|
253471
253656
|
const terminalSuccess = detectTrustedTerminalSuccess(
|
|
253472
253657
|
testCommand,
|