Skip to content

fix(decomposedfs): merge service account permissions with node grants#723

Merged
rhafer merged 1 commit into
mainfrom
fix/service-account-merge-grant-permissions
Jul 6, 2026
Merged

fix(decomposedfs): merge service account permissions with node grants#723
rhafer merged 1 commit into
mainfrom
fix/service-account-merge-grant-permissions

Conversation

@dschmidt

@dschmidt dschmidt commented Jul 2, 2026

Copy link
Copy Markdown

Problem

assemblePermissions returned ServiceAccountPermissions() early for service accounts, before reading the grants stored on the node. On project space creation the creator gets a SpaceManager grant (spaces.go), but the follow-up creator share checks SufficientCS3Permissions against those service account defaults, which lack the manager permissions. The share was denied and the space rolled back with CODE_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/... and utils/...), 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 CreateStorageSpace returns CODE_INTERNAL unpatched, CODE_OK patched): https://github.com/dschmidt/reva-serviceaccount-space-repro

Credit

Fix suggested by @rhafer.

@dschmidt dschmidt requested a review from rhafer July 2, 2026 17:57
Comment thread pkg/storage/utils/decomposedfs/node/permissions.go
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.
@rhafer rhafer force-pushed the fix/service-account-merge-grant-permissions branch from eecfddc to cbeea47 Compare July 6, 2026 10:06
@rhafer rhafer merged commit e87f7a0 into main Jul 6, 2026
18 of 19 checks passed
@rhafer rhafer deleted the fix/service-account-merge-grant-permissions branch July 6, 2026 10:44
@openclouders openclouders mentioned this pull request Jul 6, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants