Repository navigation
fix(gateway): prevent setting an expiration on the last space manager - #631
Merged
Merged
Conversation
Setting an expiration on the last permanent manager of a space was allowed, which left the space without any manager once the grant expired. updateSpaceShare only ran the "is a permanent manager remaining" check when a grant dropped the manager role (RemoveGrant=false). It now also runs when a manager grant is given an expiration, via the new mayRemoveLastPermanentManager predicate, since an expiring manager is not a permanent manager. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: David Walter <[email protected]>
dj4oC
force-pushed
the
fix/space-last-manager-expiration
branch
from
June 13, 2026 14:51
1280d6c to
2d7d069
Compare
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Author
|
@owncloud/ocis-maintainers — friendly nudge: this PR has had no review since it was opened on 2026-06-13 and CI is green. Could someone take a look when you have a moment? Happy to rebase or adjust if anything needs changing. |
2403905
approved these changes
Jul 6, 2026
butonic
added a commit
to opencloud-eu/reva
that referenced
this pull request
Nov 11, 2026
A space manager share could get an expiration even when it was the last permanent manager of the space. Once it expired the space was left without a manager. The last manager check in UpdateShare only ran when the new permissions stripped AddGrant or RemoveGrant. We now also run it when the share keeps the manager permissions but ends up with an expiration, either from the update or because it already had one and only the permissions change. Removing an expiration does not need the check. Upstream did this in the gateway, where space grants were still handled at the time (`owncloud#631`). Our space membership lives in the share provider since #593, so the check goes into UpdateShare next to the existing one, which ignores expiring managers since #990. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
mklos-kw
added a commit
that referenced
this pull request
Nov 12, 2026
* fix(gateway): prevent setting an expiration on the last space manager (#631) Setting an expiration on the last permanent manager of a space was allowed, which left the space without any manager once the grant expired. updateSpaceShare only ran the "is a permanent manager remaining" check when a grant dropped the manager role (RemoveGrant=false). It now also runs when a manager grant is given an expiration, via the new mayRemoveLastPermanentManager predicate, since an expiring manager is not a permanent manager. Signed-off-by: David Walter <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * fix: [OCISDEV-810] fix the space role and custom role checks (#653) * fix: [OCISDEV-971] escape oc:tags and lock owner name in PROPFIND responses (#652) * feat: [OCISDEV-720] fix public link --------- Signed-off-by: David Walter <[email protected]> Co-authored-by: David Walter <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: Roman Perekhod <[email protected]> Co-authored-by: Firas Frikha <[email protected]>
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
Fixes the behaviour behind owncloud/ocis#11205: an expiration date can be set on the last Manager of a space. Once that grant expires, the space is left without any manager.
Root cause
updateSpaceShare(internal/grpc/services/gateway/usershareprovider.go) guards against orphaning a space by callingisSpaceManagerRemainingbefore applying a grant. That guard was gated behindif !grant.GetPermissions().GetRemoveGrant()— i.e. it only ran when the grant was dropping the manager role. Setting an expiration on a grant that keeps the manager role (RemoveGrantstaystrue) skipped the check entirely, so an expiring grant could be written onto the only permanent manager.isSpaceManagerRemainingalready counts only permanent managers (Expiration == nil, excluding the grantee being updated), so it has everything it needs — it just wasn't being consulted in the expiration case.Fix
Run the remaining-manager check whenever the update could remove the last permanent manager — either by dropping the manager role or by giving a manager grant an expiration:
The guard in
updateSpaceSharenow uses this predicate.Testing
internal/grpc/services/gateway/usershareprovider_test.go:TestMayRemoveLastPermanentManager— a manager grant that gains an expiration is now treated like a manager-role drop (so the guard runs).TestIsSpaceManagerRemaining— documents that expiring and self grants do not keep a space managed.go test ./internal/grpc/services/gateway/passes.Downstream
This is the reva-side fix for owncloud/ocis#11205. The oCIS dependency on
owncloud/reva/v2will be bumped to pick it up once this merges.