Skip to content

Require manageUsers for another user's preferences (fixes #55) - #60

Merged
pacmano1 merged 3 commits into
diridium-com:mainfrom
iacsha:fix/55-cross-user-preferences
Nov 22, 2026
Merged

pacmano1 merged 3 commits into
diridium-com:mainfrom
iacsha:fix/55-cross-user-preferences

Conversation

@iacsha

@iacsha iacsha commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #55. Thanks @kazepoy for the precise report; the fix follows your suggestion.

  • USER_PREFERENCE_OPERATIONS (getUserPreferences, getUserPreference, setUserPreferences, setUserPreference, userNotificationAcknowledged) now map to manageUsers. They're added with putIfAbsent, so if an engine version declares a permission for one of them, that wins.
  • The caller's own preferences go through the existing self-user carve-out (isSelfUserOperation), so every role keeps working on its own even if an engine path does ask the controller about the caller's own id.
  • The comments in SecureAuthorizationController and task-permission-map.js that 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:

Call 1.3.0 This branch
GET /users/1/preferences 200 403
GET /users/1/preferences/firstlogin 204 403
PUT /users/1/preferences/<name> 204 (stored) 403
GET /users/2/preferences (own) 200 200
PUT /users/2/preferences/<name> (own) 204 204

With manageUsers added to the role, GET/PUT on 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.

…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.
@iacsha iacsha changed the title Require manageUsers for another user\x27s preferences (fixes #55) Require manageUsers for another user's preferences (fixes #55) Nov 13, 2026
pacmano1 and others added 2 commits November 21, 2026 17:38
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>
@pacmano1

Copy link
Copy Markdown
Contributor

Pushed two commits on top of yours: a merge of main (conflicted with #63 in two comments) and a follow-up.

  • The five entries now go in after the DEGRADED check. Before it, a scan that found nothing logged "Built operation-to-permission map with 5 entries" instead of the DEGRADED error. Test added.
  • The comments said the engine allows the caller's own id. On 4.7.0 it doesn't: it asks the controller even for your own preferences, so isSelfUserOperation is what keeps them working. Fixed in the controller, Swing and web comments.
  • The e2e check now requires another user's preferences refused with manageUsers (it accepted either before). README, design notes and CLAUDE.md call this out as the one place rbac assigns engine operations a permission itself, until the engine labels them.

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.

@pacmano1
pacmano1 merged commit 7b8361c into diridium-com:main Nov 22, 2026
15 checks passed
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.

Any user can read and write another user's preferences (RBAC 1.3.0)

2 participants