feat(collections): enforce RBAC on all collection handlers#2892
Merged
Conversation
Adds authz.Engine to the collections Service and gates each handler: org:read for List/ListServers, org:admin for Create/Update/Delete/ AttachServer/DetachServer. Closes an authorization gap where collection mutations were ungated despite the engine being injected via auth.Auth. Includes rbac_test.go covering denied/allowed paths per operation plus wrong-resource-id cases. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
🦋 Changeset detectedLatest commit: 5436ddd The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Collaborator
🚀 Preview Environment (PR #2892)Preview URL: https://pr-2892.dev.getgram.ai
Gram Preview Bot |
Collections list is gated by org:read, so the sidebar item should be visible to read-only members, not just org:admin. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…:admin Collections list and detail pages open up to org:read members to match the server-side read gate, while mutation affordances (create, update, delete, attach/detach server) stay behind org:admin via section- and component-level RequireScope wrappers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
adaam2
approved these changes
May 18, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Phase 1 of the collections RBAC + audit plan (
plan.md): close the authorization gap onserver/internal/collections/, where theauthz.Enginewas injected viaauth.Authbut never invoked. Scopes mirror plugins (the closest org-scoped MCP-adjacent precedent) — no new scopes needed.Server
Servicenow holds*authz.Enginedirectly and gates every handler:org:read—List,ListServersorg:admin—Create,Update,Delete,AttachServer,DetachServerrbac_test.gocovers denied-without-grants, denied-with-wrong-scope, allowed-with-correct-grant, and denied-with-wrong-org-id per operation, usingauthztest.WithExactGrants.Dashboard
Aligns the UI gating with the new server rules:
org:read(wasorg:admin-only).RequireScopewidened to["org:read", "org:admin"].CreateCollectionpage itself) kept behindorg:adminvia section- and component-levelRequireScopewrappers, so read-only members see the data but can't mutate.Phase 2 (audit logging + URN type) ships separately.
Test plan
mise run lint:servermise run test:server ./internal/collections/...— RBAC tests passorg:readmember — sidebar item shows, list + detail render, all mutation controls hiddenorg:admin— full CRUD works end-to-endResolves AGE-2416
🤖 Generated with Claude Code