Repository navigation
fix: stop subadmins from adding users of other groups to their groups - #35
Merged
Merged
Conversation
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
YvesCesar
force-pushed
the
fix/restrict-subadmin-group-additions
branch
from
November 14, 2026 15:20
0677ca9 to
b902842
Compare
vitormattos
previously approved these changes
Nov 14, 2026
…ounts fix: refuse to provision a group over an account it does not own
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.
Purpose
createAdminGroupmakes the group admin a subadmin of the group. In Nextcloud, a subadmin can add any existing user to a group they manage, with no check on the user being added. Once the user is in that group, the subadmin can edit them (email, password, display name, quota). This let the admin of one group take over users of another group, including the admin of another group. It also exposed those users, and Nextcloud admins, tousers-of-group/set-enabled, which enabled or disabled every member of the group.Changes
BeforeUserAddedListeneronBeforeUserAddedEvent. When the author is a signed in user that is neither an admin nor a delegated admin, the addition is only allowed if every group of the target user is managed by the author as subadmin, or if the target is a new account (no group, never logged in, not a subadmin). Otherwise it fails with 403. Requests without a user session (occ, cron) and admins are not affected.users-of-group/set-enabledand the re-provisioning path ofadmin-groupskip admins and delegated admins.Verification
set-enabledwithenabled=0on a group that contains an admin no longer disables the admin.Depends on #41 for the Psalm and php-cs jobs to pass on PHP 8.5.