azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[BUG] BlobContainerClient.GetPropertiesAsync() returns BlobContainerProperties with PublicAccess null instead of PublicAccessType.None

Open egraff opened this issue 3 years ago • 6 comments

Library name and version

Azure.Storage.Blobs 12.10.0

Describe the bug

Using the BlobContainerClient to send a Get Container Properties request using the GetPropertiesAsync() method, i.e.

Response<BlobContainerProperties> propertiesResponse = await containerClient.GetPropertiesAsync().ConfigureAwait(false);

if the container is configured for no public access, the returned PublicAccess of the BlobContainerProperties is null, instead of PublicAccessType.None, i.e.

propertiesResponse.Value.PublicAccess == null

instead of

propertiesResponse.Value.PublicAccess == PublicAccessType.None

This is most likely caused by how the x-ms-blob-public-access header is being treated when the response is deserialized. According to the Get Container Properties documentation for the x-ms-blob-public-access header:

If this header is not returned in the response, the container is private to the account owner.

This is a regression, as this used to work in Azure.Storage.Blobs 12.8.4 (I have not tried any versions between 12.8.4 and 12.10.0, as other issues have prevented me from upgrading).

Expected behavior

The PublicAccess of a BlobContainerProperties should be set to PublicAccessType.None if a Get Container Properties response did not contain an x-ms-blob-public-access header.

Actual behavior

The PublicAccess of a BlobContainerProperties is set to null when a Get Container Properties response does not contain an x-ms-blob-public-access header, because the code fails to account for the absence of the header and how that should map to the PublicAccessType.None value for the PublicAccessType enum.

Reproduction Steps

This was reproduced using an integration testing regression suite that emulates the Azure Blob Storage API. It can be easily reproduced by simply doing a Get Container Properties request towards real Azure Blob Storage using BlobContainerClient.GetPropertiesAsync().

Environment

>dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.400
 Commit:    d61950f9bf

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22000
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.400\

Host (useful for support):
  Version: 5.0.9
  Commit:  208e377a53

.NET SDKs installed:
  5.0.400 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

egraff avatar Feb 28 '22 09:02 egraff

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Feb 28 '22 13:02 ghost

@egraff I could see the same behavior in my environment and routing this to services team to look into.

image

SaurabhSharma-MSFT avatar Mar 01 '22 01:03 SaurabhSharma-MSFT

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

Issue Details

Library name and version

Azure.Storage.Blobs 12.10.0

Describe the bug

Using the BlobContainerClient to send a Get Container Properties request using the GetPropertiesAsync() method, i.e.

Response<BlobContainerProperties> propertiesResponse = await containerClient.GetPropertiesAsync().ConfigureAwait(false);

if the container is configured for no public access, the returned PublicAccess of the BlobContainerProperties is null, instead of PublicAccessType.None, i.e.

propertiesResponse.Value.PublicAccess == null

instead of

propertiesResponse.Value.PublicAccess == PublicAccessType.None

This is most likely caused by how the x-ms-blob-public-access header is being treated when the response is deserialized. According to the Get Container Properties documentation for the x-ms-blob-public-access header:

If this header is not returned in the response, the container is private to the account owner.

This is a regression, as this used to work in Azure.Storage.Blobs 12.8.4 (I have not tried any versions between 12.8.4 and 12.10.0, as other issues have prevented me from upgrading).

Expected behavior

The PublicAccess of a BlobContainerProperties should be set to PublicAccessType.None if a Get Container Properties response did not contain an x-ms-blob-public-access header.

Actual behavior

The PublicAccess of a BlobContainerProperties is set to null when a Get Container Properties response does not contain an x-ms-blob-public-access header, because the code fails to account for the absence of the header and how that should map to the PublicAccessType.None value for the PublicAccessType enum.

Reproduction Steps

This was reproduced using an integration testing regression suite that emulates the Azure Blob Storage API. It can be easily reproduced by simply doing a Get Container Properties request towards real Azure Blob Storage using BlobContainerClient.GetPropertiesAsync().

Environment

>dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.400
 Commit:    d61950f9bf

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22000
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.400\

Host (useful for support):
  Version: 5.0.9
  Commit:  208e377a53

.NET SDKs installed:
  5.0.400 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
Author: egraff
Assignees: -
Labels:

Storage, Service Attention, Client, customer-reported, question, needs-team-attention

Milestone: -

ghost avatar Mar 01 '22 01:03 ghost

Any updates on this? Has this been fixed?

egraff avatar Jul 15 '22 14:07 egraff

@SaurabhSharma-MSFT @xgithubtriage any updates on this?

egraff avatar Aug 02 '22 11:08 egraff

@SaurabhSharma-MSFT @xgithubtriage any updates on this?

egraff avatar Sep 20 '22 12:09 egraff

@SaurabhSharma-MSFT @xgithubtriage @jsquire any updates on this?

egraff avatar Nov 22 '22 11:11 egraff

@egraff Apologies for the late reply. I am looping in the Storage .NET Dev team to check if they can provide some assistance on this.

@amnguye @seanmcc-msft Could you please look into this issue and provide some assistance ? Thanks in advance.

navba-MSFT avatar Jan 27 '23 09:01 navba-MSFT

Apologies on the late reply.

Agreed I was able to reproduce the regression that needs to be addressed, since it's unexpected to switch from PublicAccessType.None to null.

Will be looking to make a fix and have it come out in the coming release.

amnguye avatar Jan 27 '23 21:01 amnguye

~Extra note: Need to check if ListContainer also has a regression for the PublicAccessType~ No regression found in list container item operation. Regression just to the GetProperties call

amnguye avatar Jan 27 '23 22:01 amnguye

I also checked DataLake Filesystems and such bug for PublicAccess does not exist. Shares and Queues do not have such a property.

amnguye avatar Jan 27 '23 22:01 amnguye