|
@@ -447,7 +447,7 @@ test("legacy tools config maps write/edit/patch/multiedit to edit permission", a
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-test("Truncate.DIR is allowed even when user denies external_directory globally", async () => {
|
|
|
|
|
|
|
+test("Truncate.GLOB is allowed even when user denies external_directory globally", async () => {
|
|
|
const { Truncate } = await import("../../src/tool/truncation")
|
|
const { Truncate } = await import("../../src/tool/truncation")
|
|
|
await using tmp = await tmpdir({
|
|
await using tmp = await tmpdir({
|
|
|
config: {
|
|
config: {
|
|
@@ -460,14 +460,14 @@ test("Truncate.DIR is allowed even when user denies external_directory globally"
|
|
|
directory: tmp.path,
|
|
directory: tmp.path,
|
|
|
fn: async () => {
|
|
fn: async () => {
|
|
|
const build = await Agent.get("build")
|
|
const build = await Agent.get("build")
|
|
|
- expect(PermissionNext.evaluate("external_directory", Truncate.DIR, build!.permission).action).toBe("allow")
|
|
|
|
|
expect(PermissionNext.evaluate("external_directory", Truncate.GLOB, build!.permission).action).toBe("allow")
|
|
expect(PermissionNext.evaluate("external_directory", Truncate.GLOB, build!.permission).action).toBe("allow")
|
|
|
|
|
+ expect(PermissionNext.evaluate("external_directory", Truncate.DIR, build!.permission).action).toBe("deny")
|
|
|
expect(PermissionNext.evaluate("external_directory", "/some/other/path", build!.permission).action).toBe("deny")
|
|
expect(PermissionNext.evaluate("external_directory", "/some/other/path", build!.permission).action).toBe("deny")
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-test("Truncate.DIR is allowed even when user denies external_directory per-agent", async () => {
|
|
|
|
|
|
|
+test("Truncate.GLOB is allowed even when user denies external_directory per-agent", async () => {
|
|
|
const { Truncate } = await import("../../src/tool/truncation")
|
|
const { Truncate } = await import("../../src/tool/truncation")
|
|
|
await using tmp = await tmpdir({
|
|
await using tmp = await tmpdir({
|
|
|
config: {
|
|
config: {
|
|
@@ -484,21 +484,21 @@ test("Truncate.DIR is allowed even when user denies external_directory per-agent
|
|
|
directory: tmp.path,
|
|
directory: tmp.path,
|
|
|
fn: async () => {
|
|
fn: async () => {
|
|
|
const build = await Agent.get("build")
|
|
const build = await Agent.get("build")
|
|
|
- expect(PermissionNext.evaluate("external_directory", Truncate.DIR, build!.permission).action).toBe("allow")
|
|
|
|
|
expect(PermissionNext.evaluate("external_directory", Truncate.GLOB, build!.permission).action).toBe("allow")
|
|
expect(PermissionNext.evaluate("external_directory", Truncate.GLOB, build!.permission).action).toBe("allow")
|
|
|
|
|
+ expect(PermissionNext.evaluate("external_directory", Truncate.DIR, build!.permission).action).toBe("deny")
|
|
|
expect(PermissionNext.evaluate("external_directory", "/some/other/path", build!.permission).action).toBe("deny")
|
|
expect(PermissionNext.evaluate("external_directory", "/some/other/path", build!.permission).action).toBe("deny")
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-test("explicit Truncate.DIR deny is respected", async () => {
|
|
|
|
|
|
|
+test("explicit Truncate.GLOB deny is respected", async () => {
|
|
|
const { Truncate } = await import("../../src/tool/truncation")
|
|
const { Truncate } = await import("../../src/tool/truncation")
|
|
|
await using tmp = await tmpdir({
|
|
await using tmp = await tmpdir({
|
|
|
config: {
|
|
config: {
|
|
|
permission: {
|
|
permission: {
|
|
|
external_directory: {
|
|
external_directory: {
|
|
|
"*": "deny",
|
|
"*": "deny",
|
|
|
- [Truncate.DIR]: "deny",
|
|
|
|
|
|
|
+ [Truncate.GLOB]: "deny",
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
@@ -507,8 +507,8 @@ test("explicit Truncate.DIR deny is respected", async () => {
|
|
|
directory: tmp.path,
|
|
directory: tmp.path,
|
|
|
fn: async () => {
|
|
fn: async () => {
|
|
|
const build = await Agent.get("build")
|
|
const build = await Agent.get("build")
|
|
|
- expect(PermissionNext.evaluate("external_directory", Truncate.DIR, build!.permission).action).toBe("deny")
|
|
|
|
|
expect(PermissionNext.evaluate("external_directory", Truncate.GLOB, build!.permission).action).toBe("deny")
|
|
expect(PermissionNext.evaluate("external_directory", Truncate.GLOB, build!.permission).action).toBe("deny")
|
|
|
|
|
+ expect(PermissionNext.evaluate("external_directory", Truncate.DIR, build!.permission).action).toBe("deny")
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|