Repository navigation
Description
?publicAccessBlock appears to be unrouted, so requests fall through to the bucket-level handler that shares the method. PUT reaches CreateBucket and DELETE reaches DeleteBucket — the latter destroys the bucket.
Substrate 0.82.0, ghcr.io/scttfrdmn/substrate:0.82.0, boto3/botocore from a normal pip resolution, region us-west-2.
PutPublicAccessBlock → CreateBucket
b = "pab-probe"
s3.create_bucket(Bucket=b, CreateBucketConfiguration={"LocationConstraint": "us-west-2"})
s3.put_public_access_block(
Bucket=b,
PublicAccessBlockConfiguration={
"BlockPublicAcls": True, "IgnorePublicAcls": True,
"BlockPublicPolicy": True, "RestrictPublicBuckets": True,
},
)botocore.errorfactory.BucketAlreadyExists: An error occurred (BucketAlreadyExists) when
calling the PutPublicAccessBlock operation: The requested bucket name is not available.
The wire request is well-formed and carries the subresource:
PUT http://localhost:4566/pab-probe?publicAccessBlock
<PublicAccessBlockConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<BlockPublicAcls>true</BlockPublicAcls>...
BucketAlreadyExists for a PUT on a bucket that does exist is CreateBucket's answer, so the query string is being ignored and the request dispatched on PUT /{bucket} alone. Real S3 returns 200 here.
DeletePublicAccessBlock → DeleteBucket (destroys the bucket)
Worse, because the same fall-through on DELETE reaches DeleteBucket. On an empty bucket:
s3.create_bucket(Bucket=b, CreateBucketConfiguration={"LocationConstraint": "us-west-2"})
s3.delete_public_access_block(Bucket=b) # returns 204
b in [x["Name"] for x in s3.list_buckets()["Buckets"]] # False -- the bucket is goneand the tell on a non-empty one:
s3.put_object(Bucket=b, Key="important.txt", Body=b"...")
s3.delete_public_access_block(Bucket=b)botocore.exceptions.ClientError: An error occurred (BucketNotEmpty) when calling the
DeletePublicAccessBlock operation: The bucket you tried to delete is not empty.
BucketNotEmpty is only reachable from DeleteBucket, and the error message names the operation the caller did not make. Against real S3 DeletePublicAccessBlock is 204 and the bucket is untouched either way. A caller that relaxes a public-access block on an empty bucket loses the bucket, and one that does it on a populated bucket gets an error about an operation it never issued.
GET is routed, so the pair is asymmetric
get_public_access_block returns 200 with an empty PublicAccessBlockConfiguration, which suggests the subresource is recognized on GET and only the PUT/DELETE paths are missing. So the configuration also cannot round-trip: nothing can be written for GET to return.
| Operation | substrate | real S3 |
|---|---|---|
GET ?publicAccessBlock |
200, empty config |
200 config, or NoSuchPublicAccessBlockConfiguration |
PUT ?publicAccessBlock |
409 BucketAlreadyExists (CreateBucket) |
200 |
DELETE ?publicAccessBlock |
204 and the bucket is deleted (DeleteBucket) |
204, bucket untouched |
Why it matters here
parsl-ephemeral-aws calls put_public_access_block immediately after creating a bucket it owns — it is how the provider keeps a state bucket private, replacing the deprecated ACL="private". The PUT failing makes bucket creation raise, so S3State(create_bucket_if_not_exists=True) cannot be exercised against the emulator at all; the surrounding except turns it into StateError: Failed to create S3 bucket: ... BucketAlreadyExists, which points at the wrong operation and sent me looking for a name collision that wasn't there.
Blocking public access is a standard step after CreateBucket for anything not meant to be world-readable, so I'd expect other clients to hit the PUT. The DELETE is the one worth prioritising: silent bucket deletion is a data-loss shape rather than a fidelity gap, and a test suite that tidies up by relaxing a block would take the bucket with it.
Happy to test a patch.
Activity
scttfrdmn commentedon Aug 1, 2026
Reproduced, fixed, and out for review in #459 — thanks for the detail, and particularly
for the two separate DELETE reproductions. The empty-vs-non-empty split is what made the
severity obvious.
Confirmed, and it's worse than a fidelity gap
All three verbs were unrouted. Because
?publicAccessBlockis addressed as a bare querykey on the bucket itself, each request fell through to whatever bucket-level operation
owns that method:
DELETE /bucket?publicAccessBlockDeleteBucket204— and the bucket was gonePUT /bucket?publicAccessBlockCreateBucket409 BucketAlreadyExistsGET /bucket?publicAccessBlockListObjects200+ aListBucketResultbodyYour read on the DELETE is right and it's the reason this jumped the queue over the other
open items: on an empty bucket it returns
204, which is exactly what a successfulDeletePublicAccessBlockreturns. There is no signal at all. The bucket is gone and thecaller finds out at the next operation, as an unexplained
NoSuchBucketsomewhere elseentirely.
One correction to the report
You wrote that
GETis routed and returns an empty configuration. It isn't routed — itfell through to
ListObjects. What you observed was your SDK parsing aListBucketResultbody into an emptyPublicAccessBlockConfiguration, because none ofthe four elements it looks for are present.
Worth flagging because it changes what the bug was: not "substrate forgot to store your
settings", but "substrate answered a question you didn't ask and the shapes were close
enough to parse". That reads as "public access is not blocked" — a confident wrong
answer rather than a missing one, and the harder kind to notice.
What #459 does
PUTreplaces the configuration wholesale rather than merging. The four settings areeach
Required: No, and every one your body omits is recorded — and reported back — asfalse, matching S3.DELETEis idempotent and touches nothing but the configuration. It is nowstructurally incapable of touching the bucket: the configuration lives under its own
state key, so the delete is a delete, not a rewrite of the bucket record.
The one decision worth your attention:
GETon an unconfigured bucket is a 404GetPublicAccessBlockreturns404 NoSuchPublicAccessBlockConfigurationfor a bucketthat has never been the subject of a
PutPublicAccessBlock.This took some digging, because it is not answerable from the S3 API reference — the code
is absent from the S3 2006-03-01 model, and the bucket-level
GetPublicAccessBlockpagehas no Errors section at all. Rather than guess, it was corroborated three ways:
terraform-provider-aws handles this exact code in its bucket-level
internal/service/s3package (on both Get and Delete — the Delete handling is why idempotence is right), the
s3control model's shape documentation describes the same condition, and boto3 #3627 has
the live message string verbatim.
What this means for your code: a bucket you have just created, before your
put_public_access_blockcall, will 404 rather than return fourfalses. An all-falseconfiguration you wrote deliberately is still a
200with fourfalseelements — thetwo states stay distinguishable, which is the point.
Related: substrate deliberately does not apply S3's April 2023 default of enabling all
four settings on newly created buckets. That default is real (and does cover buckets made
via the API/SDKs/CloudFormation), but it comes from AWS-managed account and organization
state substrate doesn't model — and seeding every new bucket with a configuration would
make the
NoSuchPublicAccessBlockConfigurationpath unreachable through the public API,which would leave your error branch untestable. Your
put_public_access_blockcallstraight after
create_bucketgets you a configured bucket, so this shouldn't affect yourflow.
One thing that is still missing, on purpose
The settings are recorded, not enforced. Nothing yet rejects a public ACL on a bucket
with
BlockPublicAclsset, or a public bucket policy underBlockPublicPolicy. If youhave a test asserting that your hardening actually refuses a public ACL, it will still
pass for the wrong reason. Filed separately as #458, which also argues why
RestrictPublicBucketsandIgnorePublicAclsshould stay recorded-only until substratemodels anonymous access evaluation at all.
Your offer to test a patch
Taking you up on it. The branch is
fix/446-s3-public-access-block(#459), and the twothings most worth a run against your actual code are the 404-when-unset contract above
and whether your teardown path relies on
DELETEbeing idempotent — it is, but I'd ratheryou confirm than infer. It'll be in the next release either way.
Targeted at the v0.85.0 milestone.
test(s3): cover the public-access-block state-failure paths (#446)
fix(s3): route ?publicAccessBlock so DELETE stops deleting the bucket (…
fix(s3): enforce BlockPublicAcls and BlockPublicPolicy (#458) (#466)
chore(release): v0.85.0 (#467)
fix(#1349): name every published S3 sub-resource, so an unrouted one …