You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR extends the fixes introduced in PR #12973 to address the following issues (reported by @RosiKyu):
1. Revoking a permission does not take effect until the cache expires
Only happens when dynamic.apichecker.cache.period is greater than 0. The default is 0, so default installations are not affected.
After a permission is revoked from a role, account creation carries on using the remembered copy. A restricted Domain Admin can create an account that still has the revoked permission, for as long as the cache period lasts. The window is temporary but the account created in it is permanent, so this reopens #5781 for that period.
Steps to reproduce, with cache.period=300 and the management server restarted so nothing is remembered yet:
Grant createServiceOffering to the restricted user's role (a copy of Domain Admin with that one rule denied)
Check in the database that the rule reads ALLOW
As that user, create an account with the default Domain Admin role. This is allowed at this point, and it is the call that puts the permission into the cache
Revoke createServiceOffering from the restricted user's role
Check in the database that the rule now reads DENY
Immediately create another account with the default Domain Admin role
Step 6 should be refused with Escalated APIs: [createServiceOffering]. (It succeeds instead.)
Steps 3 to 6 have to be done within the cache period, counted from step 3, because step 3 is what puts the permission into memory. If that time runs out in between, the database is read again correctly and the problem does not show.
2. A long list of escalated APIs makes the API return HTTP 500 with an empty response
Steps to reproduce, no special configuration needed:
Create a Domain Admin role with only a few rules allowed (listApis, listAccounts, listDomains, createAccount, createUser, listUsers, listConfigurations). An account on that role can see about 140 APIs.
Create an account with that role and generate API keys for it.
As that user, run createAccount with a much more privileged role. Using the default Domain Admin role gives 326 escalated APIs and returns a proper error. Using a role with a * ALLOW rule gives 786 and returns 500 with an empty response.
@nvazquez 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.
❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.02%. Comparing base (c7667d8) to head (476d43e).
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
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
This PR extends the fixes introduced in PR #12973 to address the following issues (reported by @RosiKyu):
1. Revoking a permission does not take effect until the cache expires
Only happens when
dynamic.apichecker.cache.periodis greater than 0. The default is 0, so default installations are not affected.After a permission is revoked from a role, account creation carries on using the remembered copy. A restricted Domain Admin can create an account that still has the revoked permission, for as long as the cache period lasts. The window is temporary but the account created in it is permanent, so this reopens #5781 for that period.
Steps to reproduce, with
cache.period=300and the management server restarted so nothing is remembered yet:createServiceOfferingto the restricted user's role (a copy of Domain Admin with that one rule denied)ALLOWcreateServiceOfferingfrom the restricted user's roleDENYStep 6 should be refused with
Escalated APIs: [createServiceOffering]. (It succeeds instead.)Steps 3 to 6 have to be done within the cache period, counted from step 3, because step 3 is what puts the permission into memory. If that time runs out in between, the database is read again correctly and the problem does not show.
2. A long list of escalated APIs makes the API return HTTP 500 with an empty response
Steps to reproduce, no special configuration needed:
listApis,listAccounts,listDomains,createAccount,createUser,listUsers,listConfigurations). An account on that role can see about 140 APIs.createAccountwith a much more privileged role. Using the default Domain Admin role gives 326 escalated APIs and returns a proper error. Using a role with a*ALLOW rule gives 786 and returns500with an empty response.cmk shows the failing case as:
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?