@farmslot/agent-runtime 0.39.26 → 0.39.27
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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
- Active-development baseline; add user-facing changes here before release or package publication.
|
|
6
6
|
|
|
7
|
+
## 0.39.27 - 2026-11-02
|
|
8
|
+
|
|
9
|
+
- A Grok review cannot remove, rename or replace `sessions/`, `logs/` or `logs/unified.jsonl` in the Grok home, so it cannot move a link or a prepared directory into their place for a later Grok start to write through. The farm creates any of them that is missing before the review starts, and refuses to start when one is a link or the wrong type.
|
|
10
|
+
|
|
7
11
|
## 0.39.26 - 2026-11-02
|
|
8
12
|
|
|
9
13
|
- Align `@farmslot/adapter-sdk` 0.26.1.
|
|
@@ -3,6 +3,8 @@ import type { NativeWorkerFilesystemPolicy } from './worker-launch.js';
|
|
|
3
3
|
export interface NativeReviewRuntimeAccess {
|
|
4
4
|
writablePaths?: string[];
|
|
5
5
|
dataFiles?: string[];
|
|
6
|
+
/** Files inside writable paths that keep their identity: writable, never removed or replaced. */
|
|
7
|
+
fixedPaths?: string[];
|
|
6
8
|
}
|
|
7
9
|
export interface NativeProcessSandbox {
|
|
8
10
|
executable: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-sandbox.d.ts","sourceRoot":"","sources":["../../src/native/review-sandbox.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAEvE,kGAAkG;AAClG,MAAM,WAAW,yBAAyB;IACxC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"review-sandbox.d.ts","sourceRoot":"","sources":["../../src/native/review-sandbox.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAEvE,kGAAkG;AAClG,MAAM,WAAW,yBAAyB;IACxC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,iGAAiG;IACjG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AACD,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAUD,eAAO,MAAM,0BAA0B,QARxB,OAQmD,CAAC;AACnE,4FAA4F;AAC5F,eAAO,MAAM,oBAAoB,WARrB,4BAA4B,gBACtB,MAAM,EAAE,uBACD,MAAM,EAAE,kBACb,yBAAyB,KACxC,OAAO,CAAC;IAAE,OAAO,EAAE,oBAAoB,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAA;CAAE,CAIhB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-sandbox.js","sourceRoot":"","sources":["../../src/native/review-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"review-sandbox.js","sourceRoot":"","sources":["../../src/native/review-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAe5C,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,qCAAqC,CAQ1F,CAAC;AACF,MAAM,CAAC,MAAM,0BAA0B,GAAG,cAAc,CAAC,SAAS,CAAC;AACnE,4FAA4F;AAC5F,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -32,12 +32,17 @@ async function sandbox(policy, runtimeRoots, configurationRoots = [], runtimeAcc
|
|
|
32
32
|
throw new Error('Writable review runtime path must belong to a runtime root');
|
|
33
33
|
return resolved;
|
|
34
34
|
};
|
|
35
|
+
// Named paths exist before the review starts, so a pin on one always holds something: a review
|
|
36
|
+
// cannot create an absent one as a link or a prepared directory.
|
|
35
37
|
const runtimeWritable = [];
|
|
36
|
-
for (const file of runtimeAccess.writablePaths ?? [])
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
for (const file of runtimeAccess.writablePaths ?? []) {
|
|
39
|
+
const resolved = await inRuntime(file);
|
|
40
|
+
await mkdir(resolved, { recursive: true, mode: 0o700 });
|
|
41
|
+
if (!(await lstat(resolved)).isDirectory())
|
|
42
|
+
throw new Error('Review runtime writable path must be a directory');
|
|
43
|
+
runtimeWritable.push(resolved);
|
|
44
|
+
}
|
|
45
|
+
const runtimeFile = async (file) => {
|
|
41
46
|
const resolved = await inRuntime(file);
|
|
42
47
|
try {
|
|
43
48
|
await writeFile(resolved, '', { flag: 'wx', mode: 0o600 });
|
|
@@ -45,12 +50,20 @@ async function sandbox(policy, runtimeRoots, configurationRoots = [], runtimeAcc
|
|
|
45
50
|
if (error.code !== 'EEXIST') throw error;
|
|
46
51
|
}
|
|
47
52
|
if (!(await lstat(resolved)).isFile())
|
|
48
|
-
throw new Error('Review runtime
|
|
49
|
-
|
|
50
|
-
}
|
|
53
|
+
throw new Error('Review runtime file must be a regular file');
|
|
54
|
+
return resolved;
|
|
55
|
+
};
|
|
56
|
+
// A data file keeps its identity: a review may write its bytes but not replace, rename or
|
|
57
|
+
// remove it, so a later process that opens it cannot be pointed elsewhere.
|
|
58
|
+
const runtimeData = [];
|
|
59
|
+
for (const file of runtimeAccess.dataFiles ?? []) runtimeData.push(await runtimeFile(file));
|
|
51
60
|
const restrictedRuntime = runtime.filter((root) =>
|
|
52
61
|
[...runtimeWritable, ...runtimeData].some((file) => file.startsWith(root + sep)),
|
|
53
62
|
);
|
|
63
|
+
// A writable path, and any named file in it, cannot be removed, renamed or swapped, so a review
|
|
64
|
+
// cannot move a link or a prepared directory into its place for a later process to write through.
|
|
65
|
+
const runtimeFixed = [...runtimeWritable];
|
|
66
|
+
for (const file of runtimeAccess.fixedPaths ?? []) runtimeFixed.push(await runtimeFile(file));
|
|
54
67
|
const blockedConfiguration = [];
|
|
55
68
|
for (const file of configurationRoots) {
|
|
56
69
|
const source = readOnly.find((root) => file.startsWith(root + sep));
|
|
@@ -83,6 +96,7 @@ async function sandbox(policy, runtimeRoots, configurationRoots = [], runtimeAcc
|
|
|
83
96
|
`(deny file-write-create (require-all (subpath ${JSON.stringify(root)}) (vnode-type SYMLINK)))`,
|
|
84
97
|
),
|
|
85
98
|
...restrictedRuntime.map((root) => `(deny file-link (subpath ${JSON.stringify(root)}))`),
|
|
99
|
+
...runtimeFixed.map((file) => `(deny file-write-unlink (literal ${JSON.stringify(file)}))`),
|
|
86
100
|
...blockedConfiguration.map(
|
|
87
101
|
(root) => `(deny file-read-data (subpath ${JSON.stringify(root)}))`,
|
|
88
102
|
),
|
|
@@ -227,6 +227,8 @@ const reviewConfigurationRoots = (cwd) =>
|
|
|
227
227
|
const grokReviewHomeAccess = (env) => ({
|
|
228
228
|
writablePaths: ['sessions', 'logs'].map((name) => path.join(grokHome(env), name)),
|
|
229
229
|
dataFiles: [path.join(grokHome(env), 'auth.json.lock')],
|
|
230
|
+
// The log an unsandboxed Grok start appends to.
|
|
231
|
+
fixedPaths: [path.join(grokHome(env), 'logs', 'unified.jsonl')],
|
|
230
232
|
});
|
|
231
233
|
// A Grok review checkout stays untrusted (ADR-057 Amendment 13), and Grok's terminal then stops
|
|
232
234
|
// at "Do you trust the contents of this directory?" for any checkout with project configuration.
|