Skip to content

fix: [OCISDEV-1714] keep the role of a user when settings cannot read it - #13535

Merged
2403905 merged 2 commits into
masterfrom
fix/OCISDEV-1714
Nov 20, 2026
Merged

2403905 merged 2 commits into
masterfrom
fix/OCISDEV-1714

Conversation

@2403905

@2403905 2403905 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR is the master version of #13526 (stable-8.0).

The settings service could remove the role of a user without an error:

  1. The read of a role assignment fails.
  2. ListRoleAssignments returns an empty role list.
  3. The proxy assigns the default role "User" (services/proxy/pkg/userroles/defaultrole.go, UpdateUserRoleAssignment).
  4. WriteRoleAssignment deletes the old assignments first, so an Admin becomes a User.

The main cause is in reva: each connection error of a metadata download became NotFound. owncloud/reva#822 fixes it on main. This PR bumps reva to that change. It also closes the other paths to the same result in the settings service.

Changes

The cherry-pick from stable-8.0 had one conflict. It was in the imports of services/settings/pkg/service/v0/service_test.go. I kept both errors and fmt.

Tests

  • TestSelfAssignFailsWhenAssignmentsCannotBeRead
  • TestListRoleAssignmentsWithStaleDirCache
  • TestListRoleAssignmentsByRoleSkipsGoneAccount

Related issue

How has this been tested?

  • go test ./services/settings/... ./services/proxy/pkg/userroles/... passes on this branch with the new reva.

CI notes

  • coreApiWebdavUploadTUS/lowLevelUpload.feature:58 is a flaky test, and this PR does not cause it. The third PATCH can arrive before postprocessing removes the upload session. Then tusd returns 409 and not 404. The same failure occurred on branch test/space-total-size-after-upload with an older reva.

Types of changes

  • Bug fix

🤖 Generated with Claude Code

@2403905
2403905 requested a review from a team as a code owner November 19, 2026 14:51
@kw-security

kw-security commented Nov 19, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

2403905 and others added 2 commits November 20, 2026 17:12
The settings service could remove the role of a user without an error.
An empty role list makes the proxy assign the default role "User".
WriteRoleAssignment deletes the old assignments first, so an Admin
becomes a User.

Changes:

- AssignRoleToUser in services/settings/pkg/service/v0/service.go fails
  closed. When ListRoleAssignments returns an error, the self-assignment
  returns an error and does not write.
- CachedMDC.SimpleDownload in
  services/settings/pkg/store/metadata/cache.go drops the cached listing
  of a folder when a file in it is gone. Another pod can change the
  folder, and that pod does not clear the caches of this pod.
- ListRoleAssignments in
  services/settings/pkg/store/metadata/assignments.go reads the account
  folder again after a stale listing.
- ListRoleAssignmentsByRole skips an account folder that is gone. Before,
  it returned an empty list for all accounts.

reva PR #820 fixes the cause in the metadata storage: each connection
error of a download became NotFound. A reva bump follows after that PR
is merged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Roman Perekhod <[email protected]>
…error

Bump github.com/owncloud/reva/v2 to c9ce52c985fc. This commit is the merge of owncloud/reva#822. The new reva returns the connection error of a metadata download and no longer changes it to NotFound.

Signed-off-by: Roman Perekhod <[email protected]>
@2403905
2403905 enabled auto-merge (squash) November 20, 2026 16:58
@2403905
2403905 merged commit 3c585e0 into master Nov 20, 2026
87 checks passed
@2403905
2403905 deleted the fix/OCISDEV-1714 branch November 20, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants