mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 16:14:58 +00:00
fix(security): enforce sandbox inheritance for sessions_spawn
This commit is contained in:
@@ -154,4 +154,41 @@ describe("openclaw-tools: subagents (sessions_spawn allowlist)", () => {
|
||||
acceptedAt: 5200,
|
||||
});
|
||||
});
|
||||
|
||||
it("forbids sandboxed cross-agent spawns that would unsandbox the child", async () => {
|
||||
setSessionsSpawnConfigOverride({
|
||||
session: {
|
||||
mainKey: "main",
|
||||
scope: "per-sender",
|
||||
},
|
||||
agents: {
|
||||
defaults: {
|
||||
sandbox: {
|
||||
mode: "all",
|
||||
},
|
||||
},
|
||||
list: [
|
||||
{
|
||||
id: "main",
|
||||
subagents: {
|
||||
allowAgents: ["research"],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "research",
|
||||
sandbox: {
|
||||
mode: "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const result = await executeSpawn("call11", "research");
|
||||
const details = result.details as { status?: string; error?: string };
|
||||
|
||||
expect(details.status).toBe("forbidden");
|
||||
expect(details.error).toContain("Sandboxed sessions cannot spawn unsandboxed subagents.");
|
||||
expect(callGatewayMock).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user