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
scout/forge:scout/10486-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 4 commits fork
5 files
changed +28
−8
scripts/unreached-allow.json −1
| @@ -15,7 +15,6 @@ | ||
| 15 | 15 | "src/flow/review_rounds.ts", |
| 16 | 16 | "src/flow/shared_red.ts", |
| 17 | 17 | "src/flow/stale_fold.ts", |
| 18 | "src/kernel/why_now.ts", | |
| 19 | 18 | "src/spawn/pod.ts", |
| 20 | 19 | "src/tui/gallery.ts", |
| 21 | 20 | "src/tui/ui/qr.ts", |
src/crew/sandbox.ts +10 −4
| @@ -179,12 +179,18 @@ export function dataInTemp(data: string): boolean { | ||
| 179 | 179 | |
| 180 | 180 | function tempDenied(data: string, tmpDir: string | undefined): string[] { |
| 181 | 181 | 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. | |
| 185 | 188 | return [ |
| 186 | 189 | 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 | }), | |
| 188 | 194 | ]; |
| 189 | 195 | } |
| 190 | 196 |
test/child-quota.test.ts +2 −1
| @@ -101,7 +101,8 @@ describe("child quota", () => { | ||
| 101 | 101 | |
| 102 | 102 | test("room for small but not large is refused only for large", async () => { |
| 103 | 103 | 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"; | |
| 105 | 106 | expect(quotaRefusal(dir, "small")).toBeUndefined(); |
| 106 | 107 | expect(quotaRefusal(dir, "large")).toContain("memory limit"); |
| 107 | 108 | }); |
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 | ||
| 314 | 314 | const { denyRead, tmpDir } = policy(); |
| 315 | 315 | expect(denied(join(dataDir, "crew/scout/01repo/7"), denyRead)).toBe(false); |
| 316 | 316 | 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); | |
| 318 | 323 | expect(denied(tmpDir!, denyRead)).toBe(false); |
| 319 | 324 | }); |
| 320 | 325 | |
| @@ -604,9 +609,16 @@ test.skipIf(process.platform !== "linux")("a child forge's run reads and writes | ||
| 604 | 609 | mkdirSync(join(data, "crew", "scottishbot"), { recursive: true }); |
| 605 | 610 | const neighbour = join(tmpdir(), `fc-neighbour-${Date.now()}`); |
| 606 | 611 | mkdirSync(neighbour, { recursive: true }); |
| 612 | const otherRun = join(tmpdir(), `fr-other${Date.now()}`); | |
| 613 | mkdirSync(otherRun, { recursive: true }); | |
| 607 | 614 | const p = sandboxPolicy({ dataDir: data, agentName: "scottishbot", urls: [], runId: "01m71kw4dfp4z8arr359fkygy5" }); |
| 608 | 615 | expect(p.tmpDir).toBe(join(tmpdir(), "fr-arr359fkygy5")); |
| 609 | 616 | expect(p.denyRead).not.toContain(p.tmpDir); |
| 610 | 617 | 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); | |
| 611 | 623 | expect(p.denyRead).toContain(join(data, "forge.db")); |
| 612 | 624 | }); |
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", | ||
| 81 | 81 | app.db.query("UPDATE repo SET name = ?1 WHERE id = ?2").run('x"><img src=x onerror=alert(1)>', made.value.id); |
| 82 | 82 | const form = await composerOf(cookie); |
| 83 | 83 | 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"'); | |
| 85 | 87 | expect(form).toContain("alice/x"><img src=x onerror=alert(1)>"); |
| 86 | 88 | }); |
| 87 | 89 |
new above
offline