Repository navigation
Require manageUsers for another user's preferences (fixes #55) - #60
Merged
pacmano1 merged 3 commits intoNov 22, 2026
Merged
Conversation
…m#55) The engine's preference operations (getUserPreferences, getUserPreference, setUserPreferences, setUserPreference, userNotificationAcknowledged) declare no permission. The engine scopes them with @CheckAuthorizedUserId, which asks the authorization controller only when the id is not the caller's own, and rbac answered that with allow-unknown. So any role could read and write any user's preferences, the administrator's included. They now map to manageUsers (putIfAbsent, so an engine-declared permission wins), and the caller's own preferences go through the self-user carve-out for every role. The client and web comments that called these ops self-scoped now say how. Verified on OIE 4.7.0: a role without manageUsers gets 403 on another user's preferences (GET and PUT, was 200/204) and still 200/204 on its own; a role with manageUsers still reaches another user's.
Two comment conflicts, in SecureAuthorizationController and task-permission-map.js, resolved with main's wording; the next commit rewrites both comments.
Follow-up to iacsha's commit on this branch: - The five preference entries go into the operation map after the check that reports it as DEGRADED. Added before it, they made a scan that found nothing log "Built operation-to-permission map with 5 entries" instead. New unit test; it fails with the entries before the check. - The controller, Swing and web comments: the engine asks the authorization controller even for a user's own preferences (measured on OIE 4.7.0), so rbac's own-account check is what keeps them working. The comment above the list says when it can go. - e2e: the preference checks move to their own check. Another user's preferences must be refused with "Missing permission: manageUsers" and the refused write must change nothing, whatever the engine labels; a role holding manageUsers reads them. The preference calls leave the expected-warning list. - README, design notes and CLAUDE.md: the preference calls are the one place rbac gives engine operations a permission itself, until the engine declares one. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Pushed two commits on top of yours: a merge of main (conflicted with #63 in two comments) and a follow-up.
Ran it on 4.7.0 with Derby: own preferences work for any role, another user's get a 403 without manageUsers. CI runs the six databases on the push. Co-authored with Claude Code. |
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.
Fixes #55. Thanks @kazepoy for the precise report; the fix follows your suggestion.
USER_PREFERENCE_OPERATIONS(getUserPreferences,getUserPreference,setUserPreferences,setUserPreference,userNotificationAcknowledged) now map tomanageUsers. They're added withputIfAbsent, so if an engine version declares a permission for one of them, that wins.isSelfUserOperation), so every role keeps working on its own even if an engine path does ask the controller about the caller's own id.SecureAuthorizationControllerandtask-permission-map.jsthat called these ops "self-scoped server-side" now say why that holds.Tests: for each of the five operations, another user's id is refused without
manageUsers(reason names it), allowed with it, and the caller's own id is allowed with an empty role.Checked on OIE 4.7.0 with the issue's REST calls, as a user whose role has no
manageUsers:GET /users/1/preferencesGET /users/1/preferences/firstloginPUT /users/1/preferences/<name>GET /users/2/preferences(own)PUT /users/2/preferences/<name>(own)With
manageUsersadded to the role,GET/PUTon user 1's preferences return 200/204. The Administrator client's settings tab wasn't exercised, only the REST calls behind it.mvn clean package: 417 Java tests, 0 failures, web build and tests pass. Semgrep (p/java, p/javascript): 0 findings.