Repository navigation
Allow project members to resolve their own project role - #14870
sureshanaparti wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Human validation is needed because the change alters project-role authorization at a security boundary, including domain-hierarchy isolation, lookup-versus-mutation access, and end-to-end API-checker behavior.
No open issues 🎉
What changed in this PR
This PR fixes project-view access for members assigned custom project roles by separating read-only role resolution from admin-only role mutations.
Changes:
- Adds membership-based authorization for project role and permission lookups.
- Retains administrator and dynamic-checker restrictions for mutating operations.
- Adds regression coverage for project membership, account-level membership, domain boundaries, and dynamic-checker behavior.
| File | Description |
|---|---|
| server/src/test/java/org/apache/cloudstack/acl/ProjectRoleManagerImplTest.java | Adds regression tests covering member role resolution, account-level membership, authorization boundaries, and mutation restrictions. |
| server/src/main/java/org/apache/cloudstack/acl/ProjectRoleManagerImpl.java | Separates read authorization from mutation authorization and permits authorized project members to resolve project roles and permissions. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14870 +/- ##
=============================================
- Coverage 18.34% 4.08% -14.26%
=============================================
Files 5939 449 -5490
Lines 537819 38282 -499537
Branches 65941 7083 -58858
=============================================
- Hits 98638 1564 -97074
+ Misses 427960 36503 -391457
+ Partials 11221 215 -11006
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Description
This PR allows project members to resolve their own project role.
Earlier hardening that confined domain admins to their own domain hierarchy also added checkAccess() to the project role lookup methods. That guard requires the caller to be a project Admin, but the API access checkers (ProjectRoleBasedApiAccessChecker, DomainChecker) call findProjectRole / findAllProjectRolePermissions on every request made in project context to resolve the caller's own role. A member assigned any custom project role was therefore denied before the role's permission rules were evaluated, and ApiServer surfaced it as "The given command
either does not exist, is not available for user", with nothing logged.
Keep the admin-only guard for the mutating methods and give the lookups a membership guard: root admin, domain admin within the project's domain hierarchy, or any member of the project. Non-members stay denied. The
read guard does not depend on dynamic.apichecker.enabled, because DomainChecker resolves roles regardless of that setting.
Fixes #14014
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
allow *, add a non-admin user with that role, switch to project viewHow did you try to break this feature and the system with this change?