@vzn/vx 0.0.446 → 0.0.448
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/package.json +5 -5
- package/src/exec/sandbox-runtime.ts +26 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vzn/vx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.448",
|
|
4
4
|
"description": "The fastest task runner and build cache for JavaScript monorepos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
23
23
|
"optionalDependencies": {
|
|
24
|
-
"@vzn/vx-linux-x64": "0.0.
|
|
25
|
-
"@vzn/vx-linux-arm64": "0.0.
|
|
26
|
-
"@vzn/vx-darwin-x64": "0.0.
|
|
27
|
-
"@vzn/vx-darwin-arm64": "0.0.
|
|
24
|
+
"@vzn/vx-linux-x64": "0.0.448",
|
|
25
|
+
"@vzn/vx-linux-arm64": "0.0.448",
|
|
26
|
+
"@vzn/vx-darwin-x64": "0.0.448",
|
|
27
|
+
"@vzn/vx-darwin-arm64": "0.0.448"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@anthropic-ai/sandbox-runtime": "^0.0.76"
|
|
@@ -1148,7 +1148,12 @@ export async function wrapSandboxedCommand(
|
|
|
1148
1148
|
|
|
1149
1149
|
const baselines = canonicalBaselines(args)
|
|
1150
1150
|
const customConfig = buildCustomConfig(args, baselines)
|
|
1151
|
-
const scratch = pendingWriteGrants(
|
|
1151
|
+
const scratch = pendingWriteGrants(
|
|
1152
|
+
args.config,
|
|
1153
|
+
customConfig!.filesystem!,
|
|
1154
|
+
baselines.denyRead,
|
|
1155
|
+
baselines.cwd,
|
|
1156
|
+
)
|
|
1152
1157
|
customConfig!.filesystem!.denyRead!.push(toRealPath(taskTmpRoot()))
|
|
1153
1158
|
if (process.platform === 'linux' && !cwdMounted(baselines.cwd, customConfig!.filesystem!)) {
|
|
1154
1159
|
customConfig!.filesystem!.denyRead!.push(baselines.cwd)
|
|
@@ -2400,7 +2405,7 @@ function scanOrNothing(pattern: string, base: string): Iterable<string> {
|
|
|
2400
2405
|
* write may still land under, in the sandbox's scratch, returned; the ones
|
|
2401
2406
|
* a read-only mount or the host's root holds, reported once each
|
|
2402
2407
|
* (`writeGrantMatchedNothing`). `anchors` are the deny anchors the scratch
|
|
2403
|
-
* is made of.
|
|
2408
|
+
* is made of; `within`, the task's directory, which the report spells from.
|
|
2404
2409
|
*/
|
|
2405
2410
|
export function pendingWriteGrants(
|
|
2406
2411
|
config: Pick<ResolvedSandboxConfig, 'pendingWrites'>,
|
|
@@ -2409,9 +2414,10 @@ export function pendingWriteGrants(
|
|
|
2409
2414
|
readonly allowWrite?: readonly string[] | undefined
|
|
2410
2415
|
},
|
|
2411
2416
|
anchors: readonly string[],
|
|
2417
|
+
within: string,
|
|
2412
2418
|
): string[] {
|
|
2413
2419
|
const { scratch, mountless } = scratchWrites(config.pendingWrites ?? [], fs, anchors)
|
|
2414
|
-
for (const grant of mountless) writeGrantMatchedNothing(grant)
|
|
2420
|
+
for (const grant of mountless) writeGrantMatchedNothing(grant, within)
|
|
2415
2421
|
return scratch
|
|
2416
2422
|
}
|
|
2417
2423
|
|
|
@@ -2427,18 +2433,29 @@ const warnedEmptyWriteGrant = new Set<string>()
|
|
|
2427
2433
|
* the relative pattern keeps its wildcard component), and printing it
|
|
2428
2434
|
* would tell the user to grant the PARENT of the directory they meant.
|
|
2429
2435
|
*/
|
|
2430
|
-
function writeGrantMatchedNothing(grant: string): void {
|
|
2436
|
+
function writeGrantMatchedNothing(grant: string, within: string): void {
|
|
2431
2437
|
if (warnedEmptyWriteGrant.has(grant)) return
|
|
2432
2438
|
warnedEmptyWriteGrant.add(grant)
|
|
2439
|
+
// As a committed config spells them (B-97): the absolute path held only
|
|
2440
|
+
// on the machine that printed it, as in `outsideWritesHint`.
|
|
2441
|
+
const dir = grantSpelled(grantPrefix(grant), within)
|
|
2433
2442
|
process.stderr.write(
|
|
2434
|
-
`[vx] sandbox: the write grant ${grant} matches nothing
|
|
2435
|
-
`directory read-only, so a file the task creates under
|
|
2436
|
-
`system". A bind mount ` +
|
|
2437
|
-
`
|
|
2438
|
-
`${
|
|
2443
|
+
`[vx] sandbox: the write grant ${jsString(grantSpelled(grant, within))} matches nothing ` +
|
|
2444
|
+
`yet, and a read grant mounts its directory read-only, so a file the task creates under ` +
|
|
2445
|
+
`it will fail with "Read-only file system". A bind mount covers what exists when the ` +
|
|
2446
|
+
`task starts — grant the directory instead: ` +
|
|
2447
|
+
`\`allow: { write: [${jsString(dir === '.' ? '.' : `${dir}/`)}] }\`\n`,
|
|
2439
2448
|
)
|
|
2440
2449
|
}
|
|
2441
2450
|
|
|
2451
|
+
/** An absolute grant path as a config spells it: from `within`, from `~`, or whole. */
|
|
2452
|
+
function grantSpelled(p: string, within: string): string {
|
|
2453
|
+
const real = toRealPath(within)
|
|
2454
|
+
if (atOrUnder(p, real)) return path.relative(real, p) || '.'
|
|
2455
|
+
const home = toRealPath(os.homedir())
|
|
2456
|
+
return atOrUnder(p, home) ? `~${p.slice(home.length)}` : p
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2442
2459
|
/**
|
|
2443
2460
|
* Memoized check: is `strace` on PATH on a Linux host, and does it know
|
|
2444
2461
|
* `--seccomp-bpf` (5.3+)? `'seccomp'` is the fast form; `'plain'` traces
|