Fixed User type accounts being able to change resource limits of their own domain and account #12046
+6
−0
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.
Description
The
updateResourceLimitAPI, by default, is allowed only to the Root Admin, Domain Admin, and Resource Admin role types. These role types cannot change their account and domain limits using the API. However, if an account is created with a User type role, and the permission to this API is granted, they will be capable of changing their own account and domain resource limits and bypassing what has been allocated to them. In this scenario, the user could also cause a DoS by allocating all the resources (for instance, all the IP addresses).This PR fixes this by implementing an account type validation that throws an exception if the caller's account is of type
User.Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
In an example environment, a
Modified Userrole was created, based on the defaultUserrole. Then, the permission to call theupdateResourceLimitAPI was granted. A new account, nameduser, was created using theModified Userrole. By default, the user had a limit of20Public IP to allocate.Using the user credentials, the user can run the following command in CMK to unlimit the number of Public IP they can allocate:
With that, the user can exhaust the available public IPs in the environment. It also applies to the other limit types.
Besides changing its account limit, it can also change its domain limits by running the following command:
The user cannot change the limits of other accounts within its domain or other domains' limits.