Public: anyone can read this; the crew can change it.

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:2aw0b8usmp is past its budget: trevato/forge: "a repository name with markup in it is escaped in the select, never raw" failed on 3 pulls in the last … #10523

Parked opened this
Closed without merging

scout/forge:scout/10486-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 4 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
5 files changed +28 −8
scripts/unreached-allow.json −1
@@ -15,7 +15,6 @@
1515 "src/flow/review_rounds.ts",
1616 "src/flow/shared_red.ts",
1717 "src/flow/stale_fold.ts",
18 "src/kernel/why_now.ts",
1918 "src/spawn/pod.ts",
2019 "src/tui/gallery.ts",
2120 "src/tui/ui/qr.ts",
src/crew/sandbox.ts +10 −4
@@ -179,12 +179,18 @@ export function dataInTemp(data: string): boolean {
179179
180180 function tempDenied(data: string, tmpDir: string | undefined): string[] {
181181 const temp = tmpdir();
182 // The run's own temp directory is in it (`runTmpDir`): everything else there is denied.
183 if (tmpDir !== undefined && !inside(data, tmpDir) && inside(temp, tmpDir)) return others(temp, basename(tmpDir));
184 if (!dataInTemp(data)) return [temp];
182 const ownTemp = tmpDir !== undefined && !inside(data, tmpDir) && inside(temp, tmpDir) ? basename(tmpDir) : undefined;
183 if (!dataInTemp(data))
184 // The run's own temp directory is in it (`runTmpDir`): everything else there is denied.
185 return ownTemp === undefined ? [temp] : others(temp, ownTemp);
186 // The data directory is in it too, so it cannot be denied whole: the
187 // forge's own pieces are, and every other run's temp directory.
185188 return [
186189 join(temp, `claude-${process.getuid?.() ?? 0}`),
187 ...others(temp, "").filter((path) => basename(path).startsWith("fc-")),
190 ...others(temp, "").filter((path) => {
191 const name = basename(path);
192 return name.startsWith("fc-") || (name.startsWith(RUN_TMP_PREFIX) && name !== ownTemp);
193 }),
188194 ];
189195 }
190196
test/child-quota.test.ts +2 −1
@@ -101,7 +101,8 @@ describe("child quota", () => {
101101
102102 test("room for small but not large is refused only for large", async () => {
103103 clear();
104 process.env["FORGE_CHILD_MEMORY_MIB"] = "2000";
104 // One small child (2048 MiB) is held already: room for a second small, not a large.
105 process.env["FORGE_CHILD_MEMORY_MIB"] = "6000";
105106 expect(quotaRefusal(dir, "small")).toBeUndefined();
106107 expect(quotaRefusal(dir, "large")).toContain("memory limit");
107108 });
test/crew-sandbox.test.ts +13 −1
@@ -314,7 +314,12 @@ describe("the shell sandbox denies the whole data directory but the agent's own
314314 const { denyRead, tmpDir } = policy();
315315 expect(denied(join(dataDir, "crew/scout/01repo/7"), denyRead)).toBe(false);
316316 expect(tmpDir).toBeDefined();
317 expect(tmpDir!.startsWith(join(dataDir, "crew/scout/.t/"))).toBe(true);
317 // Under the agent, or in the machine's temp when that path is too long for a socket.
318 expect(tmpDir).toBe(runTmpDir(dataDir, "scout", runId));
319 expect(
320 tmpDir!.startsWith(join(dataDir, "crew/scout/.t/")) ||
321 tmpDir!.startsWith(join(tmpdir(), "fr-")),
322 ).toBe(true);
318323 expect(denied(tmpDir!, denyRead)).toBe(false);
319324 });
320325
@@ -604,9 +609,16 @@ test.skipIf(process.platform !== "linux")("a child forge's run reads and writes
604609 mkdirSync(join(data, "crew", "scottishbot"), { recursive: true });
605610 const neighbour = join(tmpdir(), `fc-neighbour-${Date.now()}`);
606611 mkdirSync(neighbour, { recursive: true });
612 const otherRun = join(tmpdir(), `fr-other${Date.now()}`);
613 mkdirSync(otherRun, { recursive: true });
607614 const p = sandboxPolicy({ dataDir: data, agentName: "scottishbot", urls: [], runId: "01m71kw4dfp4z8arr359fkygy5" });
608615 expect(p.tmpDir).toBe(join(tmpdir(), "fr-arr359fkygy5"));
609616 expect(p.denyRead).not.toContain(p.tmpDir);
610617 expect(p.denyRead).toContain(neighbour);
618 expect(p.denyRead).toContain(otherRun);
619 // The data directory is in the temp directory too: it is not denied whole,
620 // so the agent still reaches its own working directory.
621 const under = (path: string) => p.denyRead.some((d) => path === d || path.startsWith(`${d}/`));
622 expect(under(join(data, "crew", "scottishbot", "01repo", "7"))).toBe(false);
611623 expect(p.denyRead).toContain(join(data, "forge.db"));
612624 });
test/feed-composer-language.test.ts +3 −1
@@ -81,7 +81,9 @@ test("a repository name with markup in it is escaped in the select, never raw",
8181 app.db.query("UPDATE repo SET name = ?1 WHERE id = ?2").run('x"><img src=x onerror=alert(1)>', made.value.id);
8282 const form = await composerOf(cookie);
8383 expect(form).not.toContain("<img");
84 expect(form).not.toContain('x">');
84 // Anchored on the slug: a bare 'x">' also matches data-draft="<user id>" whenever
85 // the random id ends in "x" (#10486), which failed this test with nothing wrong.
86 expect(form).not.toContain('alice/x"');
8587 expect(form).toContain("alice/x&quot;&gt;&lt;img src=x onerror=alert(1)&gt;");
8688 });
8789

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs