Thread VirtualMCPServer name into Cedar authz middleware#5448
Merged
Conversation
Cedar authorization policies compiled by the operator reference the actual VirtualMCPServer name as the resource entity (e.g. MCP::"my-vmcp"). The factory hard-coded the string "vmcp" when calling authz.CreateMiddlewareFromConfig, so the resource entity never matched and Cedar's default-deny fired on every request — 403 for all principals regardless of policy. Fix by adding a serverName parameter to NewIncomingAuthMiddleware and newCedarAuthzMiddleware, and passing vmcpCfg.Name at the serve.go call site. Adds a regression test that scopes a Cedar permit policy to a specific resource name and asserts it is honoured. Fixes #5428 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jerm-dro
approved these changes
Jun 3, 2026
reyortiz3
approved these changes
Jun 3, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5448 +/- ##
==========================================
- Coverage 68.85% 68.85% -0.01%
==========================================
Files 634 634
Lines 64437 64439 +2
==========================================
- Hits 44371 44369 -2
- Misses 16789 16792 +3
- Partials 3277 3278 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ChrisJBurns
approved these changes
Jun 3, 2026
tgrunnagle
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VirtualMCPServername as the resource entity (e.g.MCP::"my-vmcp"). The factory hard-coded the string"vmcp"when callingauthz.CreateMiddlewareFromConfig, so resource entities never matched and Cedar's default-deny fired on every request — 403 for all principals regardless of policy.serverNameparameter toNewIncomingAuthMiddlewareandnewCedarAuthzMiddleware, passingvmcpCfg.Nameat theserve.gocall site.newCedarAuthzMiddlewareso a misconfigured (empty) server name fails loudly at startup rather than silently mismatching all resource-scoped policies.Fixes #5428
Type of change
Test plan
TestNewIncomingAuthMiddleware_ServerNameThreadedthat compiles a Cedarpermitpolicy scoped toresource in MCP::"my-production-vmcp", callsNewIncomingAuthMiddlewarewithserverName = "my-production-vmcp", and asserts the request is permitted (200).serverName = "wrong-server"asserts 403 — verifies that the server name is actually threaded through to Cedar evaluation, not hardcoded.task testpasses on the affected package.Does this introduce a user-facing change?
Yes:
VirtualMCPServerCedar authorization now correctly evaluates resource-scoped policies using the server's actual name. Previously all Cedar-gated requests returned 403 when policies usedresource in MCP::"<name>"scoping.Generated with Claude Code