Azure / Azurite

A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies
MIT License
1.74k stars 309 forks source link

Response have metadata always when using List Containers API #2382

Closed SugaMi closed 2 months ago

SugaMi commented 3 months ago

Which service(blob, file, queue, table) does this issue concern?

blob service

Which version of the Azurite was used?

Azurite v3.29.0

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

VScode extension

What's the Node.js version?

What problem was encountered?

When we call List Containers API, response body has metadata even if request dosen't have include=metadata.

https://learn.microsoft.com/en-us/rest/api/storageservices/list-containers2?tabs=microsoft-entra-id

Steps to reproduce the issue?

Issue request and response

Request doesn't have include=metadata but response body has metadata

http://127.0.0.1:10000/devstoreaccount1/?comp=list&include=&sv=2023-01-03&ss=b&srt=sco&st=2024-03-27T14%3A25%3A53Z&se=2024-03-28T14%3A25%3A53Z&sp=rl&sig=xxxxxx

<EnumerationResults ServiceEndpoint="http://127.0.0.1:10000/devstoreaccount1">
<Prefix/>
<MaxResults>5000</MaxResults>
<Containers>
<Container>
<Name>tetete</Name>
<Properties>
<Last-Modified>Wed, 27 Mar 2024 12:52:35 GMT</Last-Modified>
<Etag>"0x1BDDB154194EDE0"</Etag>
<LeaseStatus>unlocked</LeaseStatus>
<LeaseState>available</LeaseState>
<HasImmutabilityPolicy>false</HasImmutabilityPolicy>
<HasLegalHold>false</HasLegalHold>
</Properties>
<Metadata>
<Metadata11111>valueeee</Metadata11111>
</Metadata>
</Container>
</Containers>
<NextMarker/>
</EnumerationResults>

correct request and response (using product

Request doesn't have include=metadata and response body doesn't have metadata.

https://xxxxxx.blob.core.windows.net/?comp=list&include=&sv=2022-11-02&ss=b&srt=sco&sp=rwdlaciytfx&se=2024-03-28T08:51:56Z&st=2024-03-28T00:51:56Z&spr=https&sig=xxxxxx

<Container>
<Name>test</Name>
<Properties>
<Last-Modified>Thu, 28 Mar 2024 00:51:19 GMT</Last-Modified>
<Etag>"0x8DC4EC12E8DA4B5"</Etag>
<LeaseStatus>unlocked</LeaseStatus>
<LeaseState>available</LeaseState>
<DefaultEncryptionScope>$account-encryption-key</DefaultEncryptionScope>
<DenyEncryptionScopeOverride>false</DenyEncryptionScopeOverride>
<HasImmutabilityPolicy>false</HasImmutabilityPolicy>
<HasLegalHold>false</HasLegalHold>
<ImmutableStorageWithVersioningEnabled>false</ImmutableStorageWithVersioningEnabled>
</Properties>
</Container>

Please be sure to remove any PII or sensitive information before sharing!
The debug log will log raw request headers and bodies, so that we can replay these against Azurite using REST and create tests to validate resolution.

Have you found a mitigation/solution?

blueww commented 3 months ago

@SugaMi

Thanks for raising this issue!

It looks caused by :in list container API , we don't cleanup container metadata even Request doesn't have include=metadata, before return it in the request responds: https://github.com/Azure/Azurite/blob/d544d16f910e490fdd9db5565459df701895308f/src/blob/handlers/ServiceHandler.ts#L325

Would you please share you scenario impacted by this issue? Then we can evaluate the priority for this issue accordingly.

Azurite welcome contribution! It would be great if you can raise a PR to fix it!

SugaMi commented 3 months ago

@blueww

Thank you for your cheking.

We cannot share detailed senario but our system use this metadata.

blueww commented 2 months ago

A fix PR is already raised in https://github.com/Azure/Azurite/pull/2389

blueww commented 2 months ago

The fix is merged, and normally will be include in the next Azurite release.