Skip to content

Commit e996b73

Browse files
committed
test: document DCG auto-approval precedence
1 parent fd8ec3a commit e996b73

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/core/auto-approval/__tests__/dcg.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ describe("Destructive Command Guard auto-approval precedence", () => {
2525
})
2626
})
2727

28+
it("does not auto-approve through DCG when global auto-approval is disabled", async () => {
29+
const state = { ...baseState, autoApprovalEnabled: false }
30+
31+
expect(await checkAutoApproval({ state, ask: "command", text: "rm file" })).toEqual({ decision: "ask" })
32+
})
33+
2834
it("requires explicit approval for a DCG-protected command", async () => {
2935
expect(
3036
await checkAutoApproval({ state: baseState, ask: "command", text: "echo safe", isProtected: true }),

src/core/auto-approval/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ export async function checkAutoApproval({
123123
if (state.alwaysAllowExecute === true) {
124124
// Execute commands immediately when DCG allows them. ExecuteCommandTool
125125
// marks commands blocked by DCG as protected before reaching this check,
126-
// which keeps the explicit user approval prompt for those commands.
126+
// which keeps the explicit user approval prompt for those commands. When
127+
// enabled, DCG is the authoritative command policy, so Zoo's allow and deny
128+
// lists are intentionally bypassed for commands that DCG allows.
127129
if (state.destructiveCommandGuardEnabled === true) {
128130
return { decision: "approve" }
129131
}

0 commit comments

Comments
 (0)