@vzn/vx 0.0.333 → 0.0.334
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 +27 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vzn/vx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.334",
|
|
4
4
|
"description": "A fast, correct 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.334",
|
|
25
|
+
"@vzn/vx-linux-arm64": "0.0.334",
|
|
26
|
+
"@vzn/vx-darwin-x64": "0.0.334",
|
|
27
|
+
"@vzn/vx-darwin-arm64": "0.0.334"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@anthropic-ai/sandbox-runtime": "^0.0.76"
|
|
@@ -737,6 +737,30 @@ function canonicalBaselines(
|
|
|
737
737
|
}
|
|
738
738
|
}
|
|
739
739
|
|
|
740
|
+
/**
|
|
741
|
+
* Linux: does some mount hold the task's cwd? bwrap enters the old cwd
|
|
742
|
+
* only if it exists in the new root, and otherwise `$HOME`, with no word:
|
|
743
|
+
* a project granted no read ran in the home directory, where `cat x.txt`
|
|
744
|
+
* read `~/x.txt`. A grant at or above the cwd holds it, and so does an
|
|
745
|
+
* existing one below (bwrap builds the path to a bind), and so does a
|
|
746
|
+
* deny that IS the cwd (a single-package workspace's anchor). When none does,
|
|
747
|
+
* the cwd is denied instead: an empty directory the task enters, whose
|
|
748
|
+
* reads are refused and reported as the anchor's are.
|
|
749
|
+
*/
|
|
750
|
+
function cwdMounted(
|
|
751
|
+
cwd: string,
|
|
752
|
+
fs: {
|
|
753
|
+
allowRead?: readonly string[] | undefined
|
|
754
|
+
allowWrite?: readonly string[] | undefined
|
|
755
|
+
denyRead?: readonly string[] | undefined
|
|
756
|
+
},
|
|
757
|
+
): boolean {
|
|
758
|
+
if (fs.denyRead?.includes(cwd) === true) return true
|
|
759
|
+
return [...(fs.allowRead ?? []), ...(fs.allowWrite ?? [])].some(
|
|
760
|
+
(p) => atOrUnder(cwd, p) || (atOrUnder(p, cwd) && existsSync(p)),
|
|
761
|
+
)
|
|
762
|
+
}
|
|
763
|
+
|
|
740
764
|
/**
|
|
741
765
|
* A write grant that names a path in the project must BIND one there. The
|
|
742
766
|
* grant was realpath'd, so `out.txt -> ../b/src/x` (committed, or planted
|
|
@@ -958,6 +982,9 @@ export async function wrapSandboxedCommand(
|
|
|
958
982
|
const customConfig = buildCustomConfig(args, baselines)
|
|
959
983
|
const scratch = pendingWriteGrants(args.config, customConfig!.filesystem!, baselines.denyRead)
|
|
960
984
|
customConfig!.filesystem!.denyRead!.push(toRealPath(taskTmpRoot()))
|
|
985
|
+
if (process.platform === 'linux' && !cwdMounted(baselines.cwd, customConfig!.filesystem!)) {
|
|
986
|
+
customConfig!.filesystem!.denyRead!.push(baselines.cwd)
|
|
987
|
+
}
|
|
961
988
|
customConfig!.filesystem!.allowWrite!.push(toRealPath(tmp))
|
|
962
989
|
if (scopedDenyScan) {
|
|
963
990
|
customConfig!.filesystem!.denyWrite!.push(
|