Repository navigation
CLDSRV-1100: Check each grant of an ACL XML body before reading it - #6423
nicolas2bert wants to merge 1 commit into
Conversation
Hello nicolas2bert,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 |
|
|
||
| apis.forEach(api => { | ||
| Object.entries(malformedGrants).forEach(([name, grant]) => { | ||
| it(`${api.name} returns MalformedACLError for ${name} and keeps the ACL`, done => { |
There was a problem hiding this comment.
Test names should start with should (repo convention). The same applies to the other it() calls in this file.
| it(`${api.name} returns MalformedACLError for ${name} and keeps the ACL`, done => { | |
| it(`${api.name} should return MalformedACLError for ${name} and keep the ACL`, done => { |
| Object.entries(malformedGrants).forEach(([name, grant]) => { | ||
| it(`${api.name} returns MalformedACLError for ${name} and keeps the ACL`, done => { | ||
| api.put(aclXml(grant), err => { | ||
| assert(err && err.is.MalformedACLError, `expected MalformedACLError, got ${err}`); |
There was a problem hiding this comment.
Compare the error message instead of using err.is. That way a failure shows a diff of the actual error name. The same applies to lines 135 and 145.
| assert(err && err.is.MalformedACLError, `expected MalformedACLError, got ${err}`); | |
| assert.strictEqual(err?.message, 'MalformedACLError'); |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
@@ Coverage Diff @@
## development/9.4 #6423 +/- ##
================================================
Coverage 86.84% 86.84%
================================================
Files 214 214
Lines 14756 14752 -4
================================================
- Hits 12815 12812 -3
+ Misses 1941 1940 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
e6a256b to
669c1a1
Compare
| assert(err && err.is.MalformedACLError, `expected MalformedACLError, got ${err}`); | ||
| api.getReadAcl((err, readAcl) => { | ||
| assert.ifError(err); | ||
| assert.deepStrictEqual(readAcl, []); |
There was a problem hiding this comment.
This doesn't prove the ACL was kept: a fresh bucket/object already has READ: [], and the old code (which replaced the ACL with an empty one for unknown types/permissions) also leaves READ: []. Seed a grant in beforeEach (e.g. a valid AllUsers READ via the same API) and assert it's still there, as the functional test does.
|
|
||
| afterEach(async () => { | ||
| const { res } = await request({ ...api.params, method: 'GET' }); | ||
| assert(res.body.includes(`<URI>${allUsers}</URI>`), 'the ACL changed'); |
There was a problem hiding this comment.
Prefer assert.match over includes so a failure shows the actual body.
| assert(res.body.includes(`<URI>${allUsers}</URI>`), 'the ACL changed'); | |
| assert.match(res.body, new RegExp(`<URI>${allUsers}</URI>`), 'the ACL changed'); |
669c1a1 to
814ab94
Compare
Issue: CLDSRV-1100
problem
If you send a broken ACL XML body to PutBucketAcl or PutObjectAcl, the server crashes instead of returning an error. And some invalid grants don't crash, but we accept them and silently drop them.
reproduction
Callback was already called.Cannot read properties of undefined (reading '0').xsi:type, withxsi:type="__proto__", or with an unknown permission. You get 200, and the grant is dropped.expected
We want the same answers as AWS, and the server stays up:
xsi:type,xsi:type="__proto__"or unknown permission: 400 MalformedACLError.AWS
We checked each case on AWS S3 on 2026-12-04, and that's what it returns.