mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-25 05:38:38 +00:00
refactor(sandbox): centralize network mode policy helpers
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveSandboxBrowserConfig } from "../agents/sandbox/config.js";
|
||||
import {
|
||||
resolveSandboxBrowserConfig,
|
||||
resolveSandboxDockerConfig,
|
||||
} from "../agents/sandbox/config.js";
|
||||
import { validateConfigObject } from "./config.js";
|
||||
|
||||
describe("sandbox docker config", () => {
|
||||
@@ -84,6 +87,22 @@ describe("sandbox docker config", () => {
|
||||
expect(res.ok).toBe(true);
|
||||
});
|
||||
|
||||
it("uses agent override precedence for dangerouslyAllowContainerNamespaceJoin", () => {
|
||||
const inherited = resolveSandboxDockerConfig({
|
||||
scope: "agent",
|
||||
globalDocker: { dangerouslyAllowContainerNamespaceJoin: true },
|
||||
agentDocker: {},
|
||||
});
|
||||
expect(inherited.dangerouslyAllowContainerNamespaceJoin).toBe(true);
|
||||
|
||||
const overridden = resolveSandboxDockerConfig({
|
||||
scope: "agent",
|
||||
globalDocker: { dangerouslyAllowContainerNamespaceJoin: true },
|
||||
agentDocker: { dangerouslyAllowContainerNamespaceJoin: false },
|
||||
});
|
||||
expect(overridden.dangerouslyAllowContainerNamespaceJoin).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects seccomp unconfined via Zod schema validation", () => {
|
||||
const res = validateConfigObject({
|
||||
agents: {
|
||||
|
||||
Reference in New Issue
Block a user