Azure / Azurite

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

The error returned in Azurite is inconsistent with the one in Azure when use queue service SAS to create queue #662

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 when use queue service SAS to create queue. In Azure, the error is shown as following: Screenshot 2020-12-15 154248 In Azurite, the error is shown as following: Screenshot 2020-12-15 152342

To Reproduce The demo code is shown as following:

import { QueueServiceClient } from "@azure/storage-queue"
import * as assert from "assert"

async function main() {
  try {
    var queueServiceClient = new QueueServiceClient("https://jacksonstorage1211.queue.core.windows.net/?sv=2020-04-08&st=2020-12-15T06:40:44Z&se=2020-12-15T08:40:44Z&sp=raup&sig=NQHenjCUuSLq%2FnOpCAsV3vQxQSnuLYuO%2FuggG1ddiis%3D");
    var queue = queueServiceClient.getQueueClient("<queue-name>");
    await queue.create();
  } catch (err) {
    assert.ok((err as any).response.parsedBody.Code === "AuthorizationFailure");
  }

  try {
    queueServiceClient = new QueueServiceClient("https://127.0.0.1:10001/devstoreaccount1/?sv=2020-04-08&st=2020-12-15T06%3A20%3A34Z&se=2020-12-15T08%3A20%3A34Z&sp=raup&sig=4RU5eN6Dhy%2B8MAcK29rt6gsue%2FW1iOl0dqfyKfR8p6s%3D")
    queue = queueServiceClient.getQueueClient("<queue-name>");
    await queue.create();
  } catch (err) {
    assert.ok((err as any).response.parsedBody.Code === "AuthorizationPermissionMismatch");
  }
}

main();

Error Track: The process code for use queue service SAS to create queue in Azurite is shown as following: https://github.com/Azure/Azurite/blob/master/src/queue/authentication/QueueSASAuthenticator.ts#L276 Screenshot 2020-12-15 154859

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

@jongio for notification.

XiaoningLiu commented 3 years ago

Thanks for bringing up this. We should improve this.

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.