fix: restore docker binds and PATH in sandbox exec (#873)

Thanks @akonyer.

Co-authored-by: Aaron Konyer <aaronk@gomodular.ca>
This commit is contained in:
Peter Steinberger
2026-01-15 02:58:20 +00:00
parent 7a839e7eb6
commit eaace34233
6 changed files with 144 additions and 1 deletions

View File

@@ -0,0 +1,60 @@
import { describe, expect, it, vi } from "vitest";
describe("sandbox docker config", () => {
it("accepts binds array in sandbox.docker config", async () => {
vi.resetModules();
const { validateConfigObject } = await import("./config.js");
const res = validateConfigObject({
agents: {
defaults: {
sandbox: {
docker: {
binds: [
"/var/run/docker.sock:/var/run/docker.sock",
"/home/user/source:/source:rw",
],
},
},
},
list: [
{
id: "main",
sandbox: {
docker: {
image: "custom-sandbox:latest",
binds: ["/home/user/projects:/projects:ro"],
},
},
},
],
},
});
expect(res.ok).toBe(true);
if (res.ok) {
expect(res.config.agents?.defaults?.sandbox?.docker?.binds).toEqual([
"/var/run/docker.sock:/var/run/docker.sock",
"/home/user/source:/source:rw",
]);
expect(res.config.agents?.list?.[0]?.sandbox?.docker?.binds).toEqual([
"/home/user/projects:/projects:ro",
]);
}
});
it("rejects non-string values in binds array", async () => {
vi.resetModules();
const { validateConfigObject } = await import("./config.js");
const res = validateConfigObject({
agents: {
defaults: {
sandbox: {
docker: {
binds: [123, "/valid/path:/path"],
},
},
},
},
});
expect(res.ok).toBe(false);
});
});

View File

@@ -77,6 +77,7 @@ export const SandboxDockerSchema = z
apparmorProfile: z.string().optional(),
dns: z.array(z.string()).optional(),
extraHosts: z.array(z.string()).optional(),
binds: z.array(z.string()).optional(),
})
.optional();