fix(FN-4638): tighten network bind scope and add fusion guard regressions

Fusion-Task-Id: FN-4638
Fusion-Task-Lineage: a6dcc3d9-b7ab-42c1-af88-c9e09f770d92
This commit is contained in:
Fusion
2026-05-15 11:11:44 -07:00
committed by gsxdsm
parent ba54957777
commit 08dd73ee1e
2 changed files with 8 additions and 3 deletions

View File

@@ -51,12 +51,12 @@ describe("sandbox-exec policy", () => {
expect(() => policyToSbplProfile({ allowNetwork: true, allowedPorts: [4040] }, ctx)).toThrow(SandboxPolicyError);
});
it("guards fusion writes", () => {
it.each(["/tmp/repo/.fusion/tasks", "/tmp/repo/.fusion/fusion.db"])("guards fusion writes for %s", (writePath) => {
expect(() =>
policyToSbplProfile(
{
allowNetwork: true,
allowedWritePaths: ["/tmp/repo/.fusion/tasks"],
allowedWritePaths: [writePath],
},
ctx,
),
@@ -67,6 +67,10 @@ describe("sandbox-exec policy", () => {
const profile = policyToSbplProfile(fusionWorktreePreset(ctx), ctx);
expect(profile).toContain("(allow file-write* (subpath \"/tmp/worktree\"))");
expect(profile).toContain("(allow file-write* (subpath \"/Users/test/Library/pnpm/store\"))");
expect(profile).toContain("(allow file-read* (subpath \"/usr\"))");
expect(profile).toContain("(allow file-read* (subpath \"/tmp/repo\"))");
expect(profile).toContain("(allow file-read* (subpath \"/usr/local/bin\"))");
expect(profile).toContain("(allow file-read* (subpath \"/private/var/folders\"))");
expect(profile).toContain("(deny network-bind (local ip \"*:4040\"))");
});
});