Repository navigation
fix(rbac): only Master Admin can confer a built-in role through inheritance - #91
Open
lorenzocorallo wants to merge 1 commit into
Open
lorenzocorallo wants to merge 1 commit into
lorenzocorallo wants to merge 1 commit into
Conversation
…itance A role reports every role it inherits, so a delegated role administrator could create a role inheriting Presidente (or Socio, Direttivo, Segretario, Student) and assign it to anyone. Unless Master Admin, a change may no longer alter which built-in roles any role inherits, and nobody else may give or take back a role that inherits one, from the dashboard, the MCP server or People. The editor stops offering those parents and assignments. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
The rule
The built-in roles are meant to be out of admins' hands. Socio, Direttivo and Student come from the identity provider itself. Presidente and Segretario are given only by a Master Admin. Holding
idp:roles:assignis not enough.How it could be got around
A role counts as holding every role it inherits. Those inherited roles show up in the
groupsandpolinetwork_rolesclaims and in the backend access snapshot, and the backend checks them.So someone who is not Master Admin, with
idp:roles:writeandidp:roles:assign, and who holds the permissions Presidente grants, could:helperthat inherits frompresidente(orsocio,direttivo,segretario,student), with no permissions of its own;helperto anyone.That person then showed up everywhere as holding
presidenteanddirettivo. Adding the parent to an existing role worked too.What is refused now
Unless you are Master Admin:
mayDelegateMutation.Master Admin can still do all of this. Nobody can inherit from Master Admin, same as before. Built-in roles' own parents (Presidente and Segretario inherit Direttivo) don't get in the way of normal edits.
The shared logic is one small function,
inheritedBuiltInRolesinsrc/auth/rbac.ts. The screens stop offering these parents and assignments to non-Masters. No new text was added to any screen. One small screen change: on a person's page, the Remove button is hidden for these roles, Presidente and Segretario included. Before, it was disabled with a tooltip that wasn't true.How inherited roles are reported (claims, snapshot, People list) is unchanged.
Does this affect anything that exists?
No. No role in production inherits from a built-in role today.
How it was tested
src/auth/rbac.test.ts: the reproduction (createhelperwith parentpresidente, then assign it) is refused at save and at assign. Also: every built-in parent, an existing role gaining one, the indirect case, removing or deleting one, Master Admin still allowed, and normal edits and assignments still allowed. The refusal tests fail on the old code.src/auth/people-binding.test.ts: the People path.src/components/rbac/delegation.test.ts: the browser helpers.src/auth/rbac-security.integration.test.mjs. I ran it against a throwaway Postgres 17 container with the migrations applied: 31/31 passed.people-roles.integration.test.tsalso passed (7/7) on the same database.vp checkpasses.vp testpasses: 369 passed, 126 skipped (the opt-in DB and HTTP suites).Docs: the README "Roles and permissions" and People sections, a new §6 in
docs/rbac-security-review.md, and one MCP tool description (set_role_people_binding) that was no longer true.The commit is not signed: 1Password signing failed in this session, and you asked me to commit without signing.