GO-6473 Restrict Admin role transitions to owner-only in ACL validator#671
Merged
requilence merged 6 commits intomainfrom May 7, 2026
Merged
GO-6473 Restrict Admin role transitions to owner-only in ACL validator#671requilence merged 6 commits intomainfrom
requilence merged 6 commits intomainfrom
Conversation
4 tasks
Contributor
Author
|
Companion PR in anytype-heart: anyproto/anytype-heart#3136 |
Coverage provided by https://github.com/seriousben/go-patch-cover-action |
deff7
approved these changes
May 7, 2026
cheggaaa
approved these changes
May 7, 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
Tighten the ACL validator so the
Adminpermission can only be granted, revoked, or removed by the spaceOwner. Previously any author withCanManageAccounts()(Owner or Admin) could perform these operations, allowing admins to escalate other members. This PR aligns the validator with the product requirement that only owners control admin membership.Validator changes (
commonspace/object/acl/list/validator.go):ValidatePermissionChange: grantingAdminor revoking from a currentAdminrequires Owner.ValidateAccountRemove: removing anAdminmember requires Owner.ValidateAccountsAdd: adding a new account atAdminlevel requires Owner.ValidateInvite/ValidateInviteChange: creating or repointing an invite atAdminlevel requires Owner.ValidateRequestAccept: approving a join request atAdminlevel requires Owner.Helper (
commonspace/object/acl/list/models.go):AclPermissions.IsAdmin()for clarity at call sites.Test plan
TestAclList_AdminCannotGrantAdminTestAclList_AdminCannotRevokeAdminTestAclList_OwnerCanGrantAndRevokeAdminTestAclList_AdminCannotRemoveAdminTestAclList_AdminCannotAddNewAdminTestAclList_AdminCannotIssueAdminInviteTestAclList_AdminCannotApproveAsAdminTestAclPermissions_IsAdminTestAclExecutorupdated to keep Admin-introducing operations under the owner.TestSettingsObject_DeleteObject_Restricted_AdminCanDeleteconfirms admins still pass the per-treeDeleteRestrictedgate (CanManageAccounts()), unchanged.go test ./...).Companion PR
The downstream consumer in anytype-heart depends on these validator changes. See companion PR in
anytype-heart(link in comments after creation).