Fix deleteUser API to prevent deletion of the caller#8691
Fix deleteUser API to prevent deletion of the caller#8691DaanHoogland merged 2 commits intoapache:mainfrom
deleteUser API to prevent deletion of the caller#8691Conversation
DaanHoogland
left a comment
There was a problem hiding this comment.
clgtm, not sure if a unit test is in order for this, @lucas-a-martins ?
@DaanHoogland thanks for your review and approval. I've added some unit tests in the latest commit. Could you take a look and let me know what you think? |
|
thanks @lucas-a-martins looks like you test both main possibilities 👍 |
|
@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. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8691 +/- ##
============================================
+ Coverage 23.14% 30.96% +7.82%
- Complexity 23348 33470 +10122
============================================
Files 5219 5355 +136
Lines 353412 375732 +22320
Branches 50883 54916 +4033
============================================
+ Hits 81805 116358 +34553
+ Misses 259762 243912 -15850
- Partials 11845 15462 +3617
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
Packaging result [SF]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 8767 |
|
@blueorangutan package |
|
@vishesh92 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 8772 |
|
Packaging result [SF]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 8783 |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8788 |
|
@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 test result (tid-9330)
|
Co-authored-by: Lucas Martins <lucas.martins@scclouds.com.br>
Description
Currently, ACS allows users to delete themselves by calling the
deleteUserAPI via CLI. Fixing this behavior has been previously suggested in this comment, as it leaves room for errors if users don't pay enough attention (e.g., when using the console's autocomplete feature), since the parameter passed is the user'sUUIDand it's not easily identifiable to whom thisUUIDbelongs. Furthermore, there's already a feature to prevent a user from deleting themselves via the UI; however, slower environments create a small window where it's possible for the user to click the button before it's disabled, allowing deletion even through the UI (see this comment).This pull request addresses this issue by adding a validation that checks the caller's
UUIDand compares it with theUUIDof the user they are trying to delete. If they are the same, an exception is thrown.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
I tested by creating a new user (Temp) and attempted to delete it using the same user via CloudMonkey.
An exception was thrown, and the user was not deleted.
Next, I attempted to delete the user via the UI by rapidly clicking the delete icon before being disabled. Once again, an exception was thrown without deleting the user as shown in the screenshot above.