#37259: fix(roles): require authenticated backend user with Roles portlet on GET /v1/roles/layouts - #37323
Merged
Merged
Conversation
…1/roles/layouts `RoleResource#getAllLayouts` was the only endpoint on the resource without a `WebResource.InitBuilder` gate, so anonymous callers received the full tool-group catalog (layout ids, names, portlet ids, localized portlet titles). Public since v23.06 (#24997), where the write twin `saveRoleLayouts` did get the gate. - Add the same InitBuilder block every sibling uses: requiredBackendUser, requiredPortlet("roles"), rejectWhenNoUser. - Pass the authenticated user from InitDataObject to getPorletTitlesFromLayout instead of re-resolving it from the request; the null-user fallback in LanguageUtil is what let the anonymous call survive. getAllLayouts was the helper's only caller. - Swagger: state the requirement in the description and on the 401 response (the gate emits 401 for every rejection); regenerate openapi.yaml. - ITs: anonymous -> 401, backend user without roles portlet -> 401, non-admin roles-portlet user -> 200 with unchanged payload shape, admin -> 200.
dario-daza
approved these changes
Sep 2, 2026
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.
Proposed Changes
GET /api/v1/roles/layouts(RoleResource#getAllLayouts) had no authentication gate — the only one of the 16 endpoints on the resource. Anonymous callers got200and the full tool-group catalog (layout ids, names, portlet ids, localized portlet titles).WebResource.InitBuilderblock every sibling uses:requiredBackendUser(true),requiredPortlet("roles"),rejectWhenNoUser(true).getPorletTitlesFromLayoutnow takes the authenticatedUserfromInitDataObjectinstead of re-resolving it from the request. The oldgetLoggedInUser(request)→LanguageUtil.get(null, key)path silently fell back to the default company user, which is what let the anonymous call succeed.getAllLayoutswas the only caller.401response state the requirement;openapi.yamlregenerated.RoleResourceIntegrationTest(MainSuite3a): anonymous → 401, backend user withoutrolesportlet → 401, non-admin user withrolesportlet → 200 (payload shape unchanged), admin → 200.Checklist
This PR fixes: #37259
This PR fixes: #37259