Repository navigation
Description
Follow-up from #458, which enforced BlockPublicAcls on PutBucketAcl and PutObjectAcl only.
The gap
Real BlockPublicAcls rejects four operations, per the S3 user guide's Block public access settings table:
PUT Bucket ACLPUT Object ACLPUT Objectwith a public ACLPUT Bucket(CreateBucket) with a public ACL
#458 covers the first two. The other two are not covered because neither handler reads x-amz-acl at all — putObject and createBucket in emulator/s3_plugin.go ignore the header entirely, so there is no ACL for a check to inspect. A consumer whose upload path sets x-amz-acl: public-read on the object gets a 200 from substrate on a bucket that real S3 would refuse.
The same gap has a second consequence independent of Block Public Access: an object uploaded with x-amz-acl: public-read reports the default owner-only ACL from GetObjectAcl, because the header was dropped. So the ACL substrate reports is not the one the caller set.
What closing this needs
ACL-on-create modelled first: putObject and createBucket resolving x-amz-acl (and the x-amz-grant-* headers — see below) into a stored ACL, after which the existing s3PublicACLDenied helper from #458 wires in unchanged.
Note also that x-amz-grant-read, -write, -read-acp, -write-acp and -full-control are parsed nowhere but #458's public-access check. An ACL set through them is not stored by any operation, including PutBucketAcl/PutObjectAcl. That is worth folding into the same change, since the grantee-list parsing already exists in emulator/s3_publicaccess.go.
Acceptance criteria
-
PutObjectandCreateBucketresolvex-amz-aclinto a stored ACL, readable back throughGetObjectAcl/GetBucketAcl -
x-amz-grant-*headers resolve into stored grants on all four operations that accept them -
PutObjectwith a public ACL on a bucket withBlockPublicAclsset returns403 AccessDenied, and the object is not stored -
CreateBucketwith a public ACL is refused when the account-level equivalent would refuse it, or the account-level gap is documented as out of scope (substrate models no account-level BPA) - The S3: Block Public Access settings are recorded but not enforced #458 tests still pass unchanged
-
docs/services.md— the "not yet refused" paragraph under Block Public Access is replaced
Activity
fix(s3): resolve x-amz-acl and x-amz-grant-* on the operations that c…
scttfrdmn commentedon Aug 2, 2026
Shipped in
6fe0f47(#509), in v0.87.0 — and your fourth criterion is answered by taking its second branch, explicitly.ACL-on-create first, then #458's check wires in unchanged.
putObjectandcreateBucketnow resolveX-Amz-Aclthrough the existings3CannedACLand persist to the same keysgetObjectAcl/getBucketAclread. So the first consequence you name is fixed independently of Block Public Access:PutObject --acl public-readfollowed byGetObjectAclnow reports the grant that was set, where before it reported the wrong ACL entirely. With the ACL stored,s3PublicACLDenied— which already took the bucket, the ACL and the headers — needed no change:PutObject --acl public-readon a bucket withBlockPublicAclsis now 403AccessDenied, and the object is not stored (checked before the write, the same all-or-nothing property #468 established on the EC2 side, and asserted with a subsequent 404).The grant-header gap is wider than your title suggests, and worth naming.
s3GrantHeadersArePublicalready parsed thex-amz-grant-*grantee lists for #458's check, but nothing stored them — includingPutBucketAcl. So an ACL set through grants rather than a canned name was stored by no operation at all. There is now ans3GrantsFromHeadersbeside that parser, applied on all four operations that accept the family, sox-amz-grant-full-controlonPutBucketAclis stored too. That is new behaviour outside what you reported, and the CHANGELOG says so.Your fourth criterion: the account-level gap is documented as out of scope. You offered a fork — refuse
CreateBucketwith a public ACL when the account-level equivalent would refuse it, or document the account-level gap. Taking the second, because substrate models no account-level Block Public Access at all, and inventing one solely to gateCreateBucketwould mean modelling a control the emulator does not otherwise have and that no other operation would consult. The reasonCreateBucketis the awkward case is structural: a bucket-level BPA configuration cannot exist before the bucket does, soCreateBucketis only refusable at the account level.docs/services.mdstates that rather than leaving the criterion ambiguously half met. If account-level BPA is worth modelling, it should be modelled for every operation at once, not conjured for one.The #458 tests pass unchanged, which was your own criterion, and
--acl privateand no header still produce owner-only.chore(release): v0.87.0 (#515)