You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
azureblob: public-read bucket requests are misreported when the account disallows public access #1240
On an Azure storage account with allowBlobPublicAccess: false (the default
for new accounts), Azure refuses any request that would make a container
public. S3Proxy misreports that refusal two ways:
CreateBucket with x-amz-acl: public-read answers BucketAlreadyOwnedByYou, although no bucket exists and none was created.
PutBucketAcl with public-read on an existing bucket answers 500
InternalError.
Found by running AwsSdkTest against a real account (reported in #1236): testCreateContainerPublicRead and testPublicReadBucketRefusesAnonymousWrite
fail. Azurite does not enforce the account setting, so CI does not see it.
Cause
AzureBlobStore.createContainer calls createBlobContainerIfNotExistsWithResponse and treats every non-201 as
"already exists". Azure refuses with 409 PublicAccessNotPermitted, and
the SDK's if-not-exists helper appears to swallow any 409, not only ContainerAlreadyExists.
AzureBlobStore.setContainerAccess calls setAccessPolicy with no catch (BlobStorageException), so the refusal is never translated. translate() has no case for PublicAccessNotPermitted either.
Expected
Both answer 403 AccessDenied with a message saying the storage account
disallows public access.
Fix sketch
Map PublicAccessNotPermitted in translate().
In createContainer, tell ContainerAlreadyExists apart from other 409s,
for example by calling the plain create and translating the exception.
Wrap setAccessPolicy in the usual try/translate.
Unit tests with a stubbed 409, since Azurite cannot produce it.
The two AwsSdkTest tests cannot pass on such an account whatever S3Proxy
answers, so they may also want a skip when the refusal is seen.
The CreateBucket cause is confirmed in the SDK. In azure-storage-blob 12.36.0, the version S3Proxy pins, BlobContainerClient.createIfNotExistsWithResponse catches any BlobStorageException whose status is 409 and reports it as "already exists" without looking at the error code. AzureBlobStore.createContainer then turns that into BucketAlreadyOwnedByYou, whatever Azure's reason for the 409 was.
It needs an account with anonymous access disabled. Both tests pass against a real account that allows it, so reproducing this takes a storage account with "Allow Blob anonymous access" off (allowBlobPublicAccess: false).
Still unverified: the exact status and error code Azure returns for the refusal. I expect 409 PublicAccessNotPermitted, but have not captured it. #1241 showed that Azure's real answers can differ from the expected ones, so the fix should be checked against such an account.
Activity
gaul commentedon Nov 16, 2026
Two updates.
The
CreateBucketcause is confirmed in the SDK. In azure-storage-blob 12.36.0, the version S3Proxy pins,BlobContainerClient.createIfNotExistsWithResponsecatches anyBlobStorageExceptionwhose status is 409 and reports it as "already exists" without looking at the error code.AzureBlobStore.createContainerthen turns that intoBucketAlreadyOwnedByYou, whatever Azure's reason for the 409 was.It needs an account with anonymous access disabled. Both tests pass against a real account that allows it, so reproducing this takes a storage account with "Allow Blob anonymous access" off (
allowBlobPublicAccess: false).Still unverified: the exact status and error code Azure returns for the refusal. I expect 409
PublicAccessNotPermitted, but have not captured it. #1241 showed that Azure's real answers can differ from the expected ones, so the fix should be checked against such an account.