Key-only buckets: strengthen browseable:false to deny listing - #22
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… masking tests - Move browseable guard before list-type validation in target_dispatcher so invalid list-type on unbrowseable buckets returns 403, not 400 - Add test_unbrowseable_hidden_from_xml_root: verify unbrowseable buckets excluded from root XML ListAllMyBuckets response - Add test in test_unbrowseable_list_denied: verify list-type=1 gets 403 - Add test_hidden_missing_key_masked on aioboto backend: verify missing keys are masked as 403 AccessDenied on unbrowseable buckets Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Supports publishing files without allowing browsing: a target with
browseable: falseis now key-only — objects can be fetched only by exact key, and nothing about the bucket's contents can be listed or probed.The behavior mirrors a real AWS S3 bucket policy that grants
s3:GetObjectbut deniess3:ListBucket, so S3-aware clients (aws cli, boto3, rclone, Neuroglancer) already understand the responses:ListObjectsV2, trailing-slash XML listings, and the HTML browse UI return403 AccessDeniedGetBucketAcl/GetObjectAclreturn403HeadBucketreturns403(requiress3:ListBucketin real S3)GET/HEADof a missing key returns403instead of404 NoSuchKey, so key existence can't be enumerated (matches S3's documented masking when ListBucket is denied)GET/HEADof an existing key works unchanged, including range requestsAll guards live in the dispatch layer (
x2s3/app.py), so every client backend is covered; no client or config changes.Test plan
tests/test_file.py(deny list/browse/ACL, 404-masking, HeadBucket, XML root exclusion, browseable buckets unaffected)tests/test_awss3.py(list denied, missing-key masking)@StephanPreibisch