fix(decomposedfs): merge service account permissions with node grants#723
Merged
Merged
Conversation
rhafer
requested changes
Jul 3, 2026
Service accounts short-circuited to ServiceAccountPermissions and ignored grants on the node (e.g. the SpaceManager grant a creator gets on project space creation), so the initial creator share was denied and the space rolled back with CODE_INTERNAL. Read the grants first, then merge the service account defaults on top.
eecfddc to
cbeea47
Compare
rhafer
approved these changes
Jul 6, 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.
Problem
assemblePermissionsreturnedServiceAccountPermissions()early for service accounts, before reading the grants stored on the node. On project space creation the creator gets aSpaceManagergrant (spaces.go), but the follow-up creator share checksSufficientCS3Permissionsagainst those service account defaults, which lack the manager permissions. The share was denied and the space rolled back withCODE_INTERNAL. #593 turned the previously tolerated creator-share failure into this hard rollback.Fix
Drop the early return: read the node grants, then union
ServiceAccountPermissions()into the result. A service account keeps its baseline permissions and additionally gets whatever a grant adds. Grants can only add, never remove.Applied to both decomposedfs copies (
pkg/...andutils/...), each with a regression test (grant an Editor role to a service account, assert the assembled set is the union of grant and defaults).Trade-off: service accounts now read node grants on every Stat instead of short-circuiting. Slightly more work per call for correct permissions.
Reproducer
Standalone repro (service account
CreateStorageSpacereturnsCODE_INTERNALunpatched,CODE_OKpatched): https://github.com/dschmidt/reva-serviceaccount-space-reproCredit
Fix suggested by @rhafer.