Skip to content

fix(mcp): guardrail authorize fails CLOSED by default#78

Merged
amitpaz1 merged 1 commit into
mainfrom
fix/mcp-guardrail-fail-closed
Jul 9, 2026
Merged

fix(mcp): guardrail authorize fails CLOSED by default#78
amitpaz1 merged 1 commit into
mainfrom
fix/mcp-guardrail-fail-closed

Conversation

@amitpaz1

@amitpaz1 amitpaz1 commented Jul 9, 2026

Copy link
Copy Markdown
Member

The AgentGate MCP guardrail (#14) failed open: authorizeTool returned null on any error from /api/mcp/authorize, and guardrailBlockResult(null) treated that as allow — so a down/unreachable AgentGate silently passed every tool call. Same class as the agentgate-ucp C1 red-team finding.

  • On authorize error, return an error verdict → guardrailBlockResult blocks the call (isError).
  • Escape hatch: AGENTGATE_GUARDRAIL_FAIL_OPEN=1 restores fail-open for advisory deployments.
  • Tests: flipped the fail-open assertion to fail-closed, added a fail-open-when-flagged case and an error-verdict block case. 60 tests green, typecheck clean.

🤖 Generated with Claude Code

The MCP guardrail (#14) called /api/mcp/authorize and, on any error,
returned null which guardrailBlockResult treated as 'allow' — a down or
unreachable AgentGate silently waved every tool call through (same
fail-open class as the agentgate-ucp C1 audit finding).

Now an authorize error yields an 'error' verdict that blocks the call.
Opt back into the old behavior with AGENTGATE_GUARDRAIL_FAIL_OPEN=1 for
deployments where the guardrail is advisory. Tests updated + added.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@amitpaz1
amitpaz1 merged commit 6563c87 into main Jul 9, 2026
@amitpaz1
amitpaz1 deleted the fix/mcp-guardrail-fail-closed branch July 9, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant