CLDSRV-1017: apply each key's own authorization verdict in multiObjectDelete - #6323
DarkIsDude wants to merge 1 commit into
Conversation
Hello darkisdude,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
| multiObjectDelete.multiObjectDelete(userAuthInfo, request, log, (err, xml) => { | ||
| assert.strictEqual(err, null); | ||
| assert.strictEqual(xml.includes('<Error><Key>deny/d</Key><Code>AccessDenied</Code>'), true); | ||
| assert.strictEqual(xml.includes('<Deleted><Key>allow/d</Key></Deleted>'), true); |
There was a problem hiding this comment.
Prefer assert.match over assert.strictEqual(xml.includes(...), true) so a failure shows the actual XML. Same for lines 653-654.
| assert.strictEqual(xml.includes('<Deleted><Key>allow/d</Key></Deleted>'), true); | |
| assert.match(xml, /<Error><Key>deny\/d<\/Key><Code>AccessDenied<\/Code>/); | |
| assert.match(xml, /<Deleted><Key>allow\/d<\/Key><\/Deleted>/); |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
@@ Coverage Diff @@
## development/9.5 #6323 +/- ##
===================================================
+ Coverage 86.55% 86.67% +0.12%
===================================================
Files 213 213
Lines 14612 14609 -3
===================================================
+ Hits 12647 12662 +15
+ Misses 1965 1947 -18
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Description
Motivation and context
When an IAM user sends a
DeleteObjectsrequest with several keys, every key gets the authorization result of the last key in the request. If the last key is allowed by the user's policy, keys outside the policy are deleted too (unauthorized data deletion); if the last key is denied, allowed keys getAccessDenied. The same keys sent alone are authorized correctly.Vault returns one authorization result per key, but
multiObjectDelete'scheckPoliciesstep collapsed those results into a map keyed by action. Since every result of a DeleteObjects request shares the same action (objectDelete), the map ended up holding only the last result'sisImplicitflag, andevaluateBucketPolicyWithIAMwas then called with that same collapsed map for every key.The fix builds the
actionImplicitDeniesmap per key, from that key's own result, so each key is authorized on its own verdict.Two regression tests cover both orderings (denied key last, allowed key last); both fail without the fix.
Related issues
Checklist
Add tests to cover the changes
tests/unit/api/multiObjectDelete.jsCode conforms with the style guide