Repository navigation
Conversation
✅ 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. |
… cannot read it 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 Opus 5.5 <noreply@anthropic.com>
2403905
force-pushed
the
fix/8.0/OCISDEV-1714
branch
from
November 18, 2026 17:29
2747d5b to
20720eb
Compare
This branch has not been deployed
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.
Description
The settings service could remove the role of a user without an error:
ListRoleAssignmentsreturns an empty role list.services/proxy/pkg/userroles/defaultrole.go,UpdateUserRoleAssignment).WriteRoleAssignmentdeletes 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#820 fixes it. This PR closes the other paths to the same result in the settings service.Changes
AssignRoleToUser(services/settings/pkg/service/v0/service.go). The self-assign check waserr == nil && len(r) > 0. A read error let the write through. Now a read error returns an error, and the service does not write.services/settings/pkg/store/metadata/cache.go). Each settings pod has its ownmemorycache by default. After a role change on pod A, the cached listing on pod B can name an assignment file that is gone. When the files cache entry expires first, the download gives a realNotFound, and the list is empty.CachedMDC.SimpleDownloadnow drops the cached listing of the folder onNotFound.services/settings/pkg/store/metadata/assignments.go).ListRoleAssignmentsreads the account folder one more time after a stale listing.ListRoleAssignmentsByRole. Before, one missing account folder made the result empty for all accounts. Only the graph user filter uses this function.Tests
I wrote each test first and saw it fail:
TestSelfAssignFailsWhenAssignmentsCannotBeRead: the old code calledWriteRoleAssignmentafter the read failed.TestListRoleAssignmentsWithStaleDirCache: twoCachedMDCinstances (two pods) on one backend. The old code returned[].TestListRoleAssignmentsByRoleSkipsGoneAccount: the old code returned[]and not 2 assignments.Related issue
How has this been tested?
go test ./services/settings/... ./services/proxy/...go.work.go vetreportsservices/settings/pkg/server/grpc/server.go:82, andmake -C services/settings golangci-lintreports 19 typecheck errors. Both are the same without this change.Types of changes
🤖 Generated with Claude Code