mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 13:01:42 +03:00
fix: close OC-02 gaps in ACP permission + gateway HTTP deny config (#15390) (thanks @aether-ai-agent)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
describe("gateway.tools config", () => {
|
||||
it("accepts gateway.tools allow and deny lists", async () => {
|
||||
vi.resetModules();
|
||||
const { validateConfigObject } = await import("./config.js");
|
||||
const res = validateConfigObject({
|
||||
gateway: {
|
||||
tools: {
|
||||
allow: ["gateway"],
|
||||
deny: ["sessions_spawn", "sessions_send"],
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(res.ok).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects invalid gateway.tools values", async () => {
|
||||
vi.resetModules();
|
||||
const { validateConfigObject } = await import("./config.js");
|
||||
const res = validateConfigObject({
|
||||
gateway: {
|
||||
tools: {
|
||||
allow: "gateway",
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(res.ok).toBe(false);
|
||||
if (!res.ok) {
|
||||
expect(res.issues[0]?.path).toBe("gateway.tools.allow");
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -404,6 +404,13 @@ export const OpenClawSchema = z
|
||||
.strict()
|
||||
.optional(),
|
||||
trustedProxies: z.array(z.string()).optional(),
|
||||
tools: z
|
||||
.object({
|
||||
deny: z.array(z.string()).optional(),
|
||||
allow: z.array(z.string()).optional(),
|
||||
})
|
||||
.strict()
|
||||
.optional(),
|
||||
tailscale: z
|
||||
.object({
|
||||
mode: z.union([z.literal("off"), z.literal("serve"), z.literal("funnel")]).optional(),
|
||||
|
||||
Reference in New Issue
Block a user