Fix role escalation prevention#7853
Conversation
|
Hi @hsato03 thanks for the PR. The dynamic checker is used by default and we don't ship commands.properties with cloudstack for several years now, how can we test/verify your claims? |
|
Hello @rohityadavcloud. You can test it by doing the same tests I did. Before the changes, the account will be created and no exception will be thrown.
|
|
@blueorangutan package |
Codecov Report
@@ Coverage Diff @@
## 4.18 #7853 +/- ##
=========================================
Coverage 13.02% 13.02%
- Complexity 9029 9039 +10
=========================================
Files 2720 2720
Lines 257010 257096 +86
Branches 40083 40093 +10
=========================================
+ Hits 33467 33489 +22
- Misses 219342 219403 +61
- Partials 4201 4204 +3
... and 18 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
| if (isEnabled()) { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
if this prevents the escalation talked about fine, but it seems illogical to return true to prevent access. would return false not make more sense?
There was a problem hiding this comment.
@DaanHoogland I don't think so. Actually this isEnabled method checks if DynamicRoleBasedAPIAccessChecker is enabled. Returning true here is just passing the check responsibility to another class.
There was a problem hiding this comment.
yes @hsato03 I think you are right. I consider it a bug that the StaticRoleBasedAPIAccessChecker.isEnabled() would return true if it is disabled (but the dynamic one is enabled). Maybe this is a discussion out of scope for your change. As said, "if this prevents the escalation talked about (it is) fine"
There was a problem hiding this comment.
yes, it looks like a bug @DaanHoogland
we should change the return value of isEnabled in this class
weizhouapache
left a comment
There was a problem hiding this comment.
code lgtm
It should be better to change the return value of method isEnabled, but it might have large impact.
|
@blueorangutan package |
|
@weizhouapache a [SF] 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. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 6785 |
|
@blueorangutan test |
|
@weizhouapache a [SF] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@blueorangutan package |
|
@weizhouapache a [SF] 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. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 6810 |
|
@blueorangutan test |
|
@weizhouapache a [SF] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-7434)
|
|
[SF] Trillian test result (tid-7451)
|
|
@DaanHoogland @rohityadavcloud |
|
Awesome work, congrats on your first merged pull request! |
Description
While checking an account access to prevent the role escalation, the
checkAccessmethod is using bothDynamicRoleBasedAPIAccessCheckerandStaticRoleBasedAPIAccessChecker(legacy) classes and that is causing some inconsistences in the validations, consequently allowing the role escalation.For this reason, the
StaticRoleBasedAPIAccessCheckerwas disabled ifDynamicRoleBasedAPIAccessCheckeris enabled.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
*regex;