Fix being able to expunge a VM through destroyVirtualMachine even when role rule does not allow#8689
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8689 +/- ##
============================================
- Coverage 23.14% 23.13% -0.02%
- Complexity 23348 23485 +137
============================================
Files 5219 5234 +15
Lines 353412 355729 +2317
Branches 50883 51238 +355
============================================
+ Hits 81805 82294 +489
- Misses 259762 261540 +1778
- Partials 11845 11895 +50
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
@blueorangutan package |
|
@DaanHoogland 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. |
|
Packaging result [SF]: ✔️ el7 ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 8745 |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8755 |
|
@gpordeus , this sounds like a good use case for an integration test. Will you consider that? |
Sure, on it. |
|
@blueorangutan package |
|
@weizhouapache 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. |
|
Packaging result [SF]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 8764 |
|
Packaging result [SF]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 8780 |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8787 |
|
@blueorangutan package |
|
@weizhouapache 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. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8874 |
|
@blueorangutan test alma9 kvm-alma9 |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (alma9 mgmt + kvm-alma9) has been kicked to run smoke tests |
|
[SF] Trillian Build Failed (tid-9434) |
|
not sure why the bot removed the conflict sticker, but you still have some @gpordeus |
|
@DaanHoogland Fixed, thanks for letting me know. |
|
@weizhouapache, are your concerns met? @DaanHoogland, could you trigger the CI one last time? |
|
@DaanHoogland, my bad, I did not see the comment at #8878 (comment), you can ignore my other comments. |
|
@blueorangutan package |
|
@JoaoJandre 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. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10459 |
|
@blueorangutan package |
|
@JoaoJandre 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. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 10642 |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 10661 |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10680 |
|
@blueorangutan LLtest |
|
@DaanHoogland a [LL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
[LL] Trillian Build Failed (tid-6968) |
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-11094)
|
|
@weizhouapache are you alright with this one, now? |
|
@DaanHoogland not tested |
good, @lucas-a-martins has: #8689 (review) |
…n role rule does not allow (apache#8689)
Description
This PR adds a role access check to the
expungeVirtualMachinecommand when callingdestroyVirtualMachinewith the expunge parameter.Currently, if you are an admin (even if not Root), it bypasses the
allow.user.expunge.recover.vmverification and you are always allowed to expunge when calling fordestroyVirtualMachine.The use case that called for this change was a need for a role of type domain admin to be unable to expunge VMs. It was then found that even with the DENY rule, the user could still expunge through
destroyVirtualMachine(even on already destroyed VMs, with an API call) and the settingallow.user.expunge.recover.vmdid nothing.Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
I created a role, based on the default Domain Admin, and changed the
expungeVirtualMachinerule toDENY. I then created an account with said role.I created two VMs and destroyed one of them, verifying that the expunge option did not show up on the GUI.
I then ran
destroy virtualmachineon cloudmonkey withexpunge = trueon both VMs and both returned the errorAccount does not have permission for expunging. Calling the same command without the parameter destroyed the running VM successfully.I repeated the tests with a role based on default User:
With
allow.user.expunge.recover.vm = true, it behaved the same as the DomainAdmin-based one.With
allow.user.expunge.recover.vm = false, it did not allow the expunge action, no matter the role rules. Without the expunge parameter, the destroy action worked as expected.