Skip to content

CLDSRV-1100: Check each grant of an ACL XML body before reading it - #6423

Open
nicolas2bert wants to merge 1 commit into
development/9.4from
bugfix/CLDSRV-1100-validate-acl-xml-grants
Open

nicolas2bert wants to merge 1 commit into
development/9.4from
bugfix/CLDSRV-1100-validate-acl-xml-grants

Conversation

@nicolas2bert

@nicolas2bert nicolas2bert commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

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

  1. As the bucket owner, send a PutBucketAcl XML with two invalid group URIs. You get 400 InvalidArgument, then the worker exits with Callback was already called.
  2. Send a Grant with no Grantee. The worker exits with Cannot read properties of undefined (reading '0').
  3. Send a Grant with an unknown xsi:type, with xsi: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:

  • Grant without Grantee, Grantee without ID or URI, Grant without Permission: 400 MalformedACLError.
  • Two invalid group URIs: 400 InvalidArgument.
  • Unknown 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.

@bert-e

bert-e commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Hello nicolas2bert,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval ⭐
/bypass_build_status Bypass the build and test status ⭐
/bypass_commit_size Bypass the check on the size of the changeset TBA ⭐
/bypass_incompatible_branch Bypass the check on the source branch prefix ⭐
/bypass_jira_check Bypass the Jira issue check ⭐
/bypass_peer_approval Bypass the pull request peers' approval ⭐
/bypass_leader_approval Bypass the pull request leaders' approval ⭐
/bypass_source_branch_lineage Bypass the cross-branch contamination check ⭐
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request.
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@bert-e

bert-e commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Incorrect fix version

The Fix Version/s in issue CLDSRV-1100 contains:

  • None

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 9.4.24

  • 9.5.14

  • 9.6.4

  • 9.7.0

Please check the Fix Version/s of CLDSRV-1100, or the target
branch of this pull request.


apis.forEach(api => {
Object.entries(malformedGrants).forEach(([name, grant]) => {
it(`${api.name} returns MalformedACLError for ${name} and keeps the ACL`, done => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test names should start with should (repo convention). The same applies to the other it() calls in this file.

Suggested change
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}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
assert(err && err.is.MalformedACLError, `expected MalformedACLError, got ${err}`);
assert.strictEqual(err?.message, 'MalformedACLError');

@codecov

codecov Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.84%. Comparing base (28b50da) to head (814ab94).
⚠️ Report is 13 commits behind head on development/9.4.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
lib/api/bucketPutACL.js 97.16% <100.00%> (+0.44%) ⬆️
lib/api/objectPutACL.js 97.32% <100.00%> (-0.34%) ⬇️
lib/utilities/aclUtils.js 86.38% <100.00%> (+2.33%) ⬆️
@@               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     
Flag Coverage Δ
checksums-disabled-tests 35.24% <7.89%> (+0.02%) ⬆️
file-ft-tests 69.71% <100.00%> (+0.04%) ⬆️
file-ft-tests-null-compat 70.20% <100.00%> (+0.05%) ⬆️
kmip-ft-tests 28.03% <7.89%> (+0.02%) ⬆️
mongo-v0-ft-tests 70.83% <100.00%> (+0.05%) ⬆️
mongo-v1-ft-tests 70.85% <100.00%> (+0.07%) ⬆️
multiple-backend 35.96% <7.89%> (+0.03%) ⬆️
s3c-ft-tests-v0 64.86% <65.78%> (+0.07%) ⬆️
s3c-ft-tests-v0-null-compat 64.92% <65.78%> (+0.07%) ⬆️
s3c-ft-tests-v0-replication-compat 64.74% <65.78%> (+0.10%) ⬆️
s3c-ft-tests-v1 64.84% <65.78%> (+0.09%) ⬆️
sur-tests 36.45% <7.89%> (+0.05%) ⬆️
sur-tests-inflights 39.23% <7.89%> (+<0.01%) ⬆️
unit 75.25% <100.00%> (+<0.01%) ⬆️
utapi-v2-tests 35.20% <7.89%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nicolas2bert
nicolas2bert force-pushed the bugfix/CLDSRV-1100-validate-acl-xml-grants branch from e6a256b to 669c1a1 Compare December 5, 2026 13:24
assert(err && err.is.MalformedACLError, `expected MalformedACLError, got ${err}`);
api.getReadAcl((err, readAcl) => {
assert.ifError(err);
assert.deepStrictEqual(readAcl, []);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer assert.match over includes so a failure shows the actual body.

Suggested change
assert(res.body.includes(`<URI>${allUsers}</URI>`), 'the ACL changed');
assert.match(res.body, new RegExp(`<URI>${allUsers}</URI>`), 'the ACL changed');

@nicolas2bert
nicolas2bert force-pushed the bugfix/CLDSRV-1100-validate-acl-xml-grants branch from 669c1a1 to 814ab94 Compare December 5, 2026 13:29

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants