mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 11:27:39 +00:00
Media: include state workspace/sandbox in local path allowlist
This commit is contained in:
@@ -332,4 +332,31 @@ describe("local media root guard", () => {
|
||||
const result = await loadWebMedia(tinyPngFile, 1024 * 1024, { localRoots: "any" });
|
||||
expect(result.kind).toBe("image");
|
||||
});
|
||||
|
||||
it("allows default OpenClaw state workspace and sandbox roots", async () => {
|
||||
const { STATE_DIR } = await import("../config/paths.js");
|
||||
const readFile = vi.fn(async () => Buffer.from("generated-media"));
|
||||
|
||||
await expect(
|
||||
loadWebMedia(path.join(STATE_DIR, "workspace", "tmp", "render.bin"), {
|
||||
maxBytes: 1024 * 1024,
|
||||
readFile,
|
||||
}),
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
kind: "unknown",
|
||||
}),
|
||||
);
|
||||
|
||||
await expect(
|
||||
loadWebMedia(path.join(STATE_DIR, "sandboxes", "session-1", "frame.bin"), {
|
||||
maxBytes: 1024 * 1024,
|
||||
readFile,
|
||||
}),
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
kind: "unknown",
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user