Repository navigation
Conversation
… guard The domain branch guard parsed as (ownDomain && DOMAIN_ADMIN) || RESOURCE_DOMAIN_ADMIN because && binds tighter than ||, so a resource domain admin was denied updating the limits of every domain, including sub-domains it administers. Group the two admin types so only the caller's own domain is rejected, the same way the account branch of the method already does.
DaanHoogland
left a comment
There was a problem hiding this comment.
clgtm, but needs testing rigorously
|
Thanks @DaanHoogland. Tested it both ways. Unit on 4.20: Live on a 4.23 management server, as a resource domain admin updating a subdomain's resource limit:
Glad to add anything else you'd find useful. |
69c73a8 to
592f59e
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #14141 +/- ##
============================================
+ Coverage 4.14% 16.46% +12.32%
- Complexity 0 13718 +13718
============================================
Files 405 5670 +5265
Lines 33073 501771 +468698
Branches 5903 60965 +55062
============================================
+ Hits 1370 82632 +81262
- Misses 31527 409868 +378341
- Partials 176 9271 +9095
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:
|
Description
The domain branch guard in updateResourceLimit is
ownDomain && type == DOMAIN_ADMIN || type == RESOURCE_DOMAIN_ADMIN. Since&&binds tighter than||, a resource domain admin is denied updating the limits of every domain, including its own sub-domains ("Unable to update resource limit for domain X, permission denied"). The intent, like the account branch just above it, is only to block an admin on its own domain. This adds the missing parentheses.Resource domain admins exist only in domains that own a private zone, so this affects those setups. The own domain rule is unchanged, and so is the own account rule discussed in #10922. The same code is on 4.20, 4.22 and main, so this targets 4.20.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
N/A
How Has This Been Tested?
Added two tests to ResourceLimitManagerImplTest: a resource domain admin updating a sub-domain (fails before with PermissionDeniedException, passes after) and the same admin on its own domain (denied before and after). The class passes (57 tests).
Also verified on a live 4.23 KVM environment with the same change: domain /rl-live with sub-domain /rl-live/rl-live-sub, and a Resource Admin account rladmin in /rl-live calling updateResourceLimit (user VMs, max 10).
Before:
After:
How did you try to break this feature and the system with this change?
Domain admins and root admins behave exactly as before, and both admin types are still denied on their own domain. A resource domain admin on another domain still has to pass checkAccess and the parent domain limit check, so it cannot reach domains outside its tree.