Azure / Azurite

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

The error returned in azurite is inconsistent with the one in azure cloud when use blob service SAS to create container #637

Open zzhxiaofeng opened 3 years ago

zzhxiaofeng commented 3 years ago

Error Description: The error returned in azurite is inconsistent with the one in azure cloud when use blob service SAS to create container In azure, the error is shown as following: Screenshot 2020-11-19 185908 In azurite, the error is shown as following: Screenshot 2020-11-19 190610

To Reproduce The demo code is shown as following:

import {
  ContainerClient
} from "@azure/storage-blob";
import * as assert from "assert"

async function main() {
  var containerClient= new ContainerClient("https://storagetestjackson.blob.core.windows.net/test-container-e5e6ba7e-386f-4af1-ad63-7bd219ed9f96?sv=2020-02-10&st=2020-11-19T09%3A57%3A08Z&se=2020-11-19T11%3A57%3A08Z&sr=c&sp=racwdl&sig=eyyAmy7m2PudbDRTLIJiESBmc2F8oJEXHI1zy2Kd%2BL8%3D");
  try{
    await containerClient.create();
  }catch(err){
    console.log(err);
    assert.ok((err as any).response.parsedBody.Code === "AuthorizationFailure");
  }
  containerClient = new ContainerClient("https://127.0.0.1:10000/devstoreaccount1/test-container-bb5647c7-ae6d-484a-8fd4-a109253dd21a?sv=2020-02-10&st=2020-11-19T10%3A04%3A27Z&se=2020-11-19T12%3A04%3A27Z&sr=c&sp=racwdl&sig=MhbckIFoH%2BaZVHQTlyeQZdl%2FIsadINWHaZ7dFJxilCQ%3D");
  try{
    await containerClient.create();
  }catch(err){
    console.log(err);
    assert.ok((err as any).response.parsedBody.Code === "AuthorizationPermissionMismatch");
  }
}

main();

Error Track: The process code for use blob service SAS to create container in Azurite is shown as following: https://github.com/Azure/Azurite/blob/master/src/blob/authentication/BlobSASAuthenticator.ts#L304 Screenshot 2020-11-18 194316

Expected Behavior The error returned in Azurite is consistent with the one in Azure when use blob service SAS to create container.

@jongio for notification.

blueww commented 3 years ago

@zzhxiaofeng Thanks for raising the issue! We will evaluate it.

We welcome contribution to Azurite. It would be great if you could contribute the the fix of this issue.

v-xuto commented 3 years ago

azsdk-azurite

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.