The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
Honor Claude policy deny on permission-request, not just pre-tool
Claude59e7e90a1d9e
diff --git a/cli/beacon-hooks/cmd/policy.go b/cli/beacon-hooks/cmd/policy.goindex 1a7ff044..ae10a056 100644--- a/cli/beacon-hooks/cmd/policy.go+++ b/cli/beacon-hooks/cmd/policy.go@@ -41,7 +41,7 @@ func enforcePolicy(logger *logging.Logger, input map[string]interface{}, sessionif reason == "" {reason = "Tool call denied by policy provider"}- deny := policyDenyResponse(phase, reason)+ deny := policyDenyResponse(reason)if deny == nil {// Platform has no deny shape: honor "unknown platform -> allow".return nil, false@@ -151,9 +151,11 @@ func emitPolicyDenied(logger *logging.Logger, input map[string]interface{}, c po}// policyDenyResponse returns the runtime-specific hook response that denies the-// tool call. A nil return means the platform has no confirmed deny shape for this-// phase, so the caller allows (unknown platform -> allow).-func policyDenyResponse(phase policycontract.Phase, reason string) map[string]interface{} {+// tool call. A nil return means the platform has no confirmed deny shape, so the+// caller allows (unknown platform -> allow). It is phase-independent: a platform+// with a confirmed deny shape honors a deny in every phase the seam runs in, so a+// provider deny is never silently dropped for a platform we enforce on.+func policyDenyResponse(reason string) map[string]interface{} {switch {case platformFlag == "cursor":return map[string]interface{}{"permission": "deny"}@@ -161,7 +163,7 @@ func policyDenyResponse(phase policycontract.Phase, reason string) map[string]inreturn map[string]interface{}{"decision": "reject"}case platformFlag == "antigravity" || platformFlag == "grok":return map[string]interface{}{"decision": "deny"}- case platformFlag == "claude" && phase == policycontract.PhasePreTool:+ case platformFlag == "claude":return map[string]interface{}{"hookSpecificOutput": map[string]interface{}{"hookEventName": "PreToolUse",diff --git a/cli/beacon-hooks/cmd/policy_test.go b/cli/beacon-hooks/cmd/policy_test.goindex 387c78aa..c254b1cb 100644--- a/cli/beacon-hooks/cmd/policy_test.go+++ b/cli/beacon-hooks/cmd/policy_test.go@@ -116,6 +116,26 @@ func TestPreToolPolicyAllowProceedsNormally(t *testing.T) {}}+func TestPermissionRequestPolicyDenyClaude(t *testing.T) {+ // Regression: Claude is a confirmed-deny platform, so a provider deny on the+ // permission-request hook must be honored (not silently allowed) just like on+ // pre-tool.+ logPath := setupPolicyTest(t, "claude", denyResponse)+ out := runHookWithInput(t, runPermissionRequest, map[string]interface{}{+ "session_id": "s-claude-perm",+ "tool_name": "Bash",+ "tool_input": map[string]interface{}{"command": "claude --dangerously-skip-permissions"},+ })+ hso, ok := out["hookSpecificOutput"].(map[string]interface{})+ if !ok {+ t.Fatalf("claude permission-request deny = %#v, want hookSpecificOutput", out)+ }+ if hso["permissionDecision"] != "deny" {+ t.Fatalf("hookSpecificOutput = %#v, want permissionDecision=deny", hso)+ }+ assertDenialEvent(t, logPath)+}+func TestPermissionRequestPolicyDenyDevin(t *testing.T) {logPath := setupPolicyTest(t, "devin", denyResponse)out := runHookWithInput(t, runPermissionRequest, map[string]interface{}{