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

Azurite doesn't check if the retention time is too long when set service properties #815

Open zzhxiaofeng opened 3 years ago

zzhxiaofeng commented 3 years ago

Error Description: Azurite doesn't check if the retention time is too long when set service properties. If the retention days is greater than 365 days, Azurite doesn't return an error and Azure will return an error as following: Screenshot 2021-06-08 102254

To Reproduce: Please run the demo code as following:

import { delay } from "@azure/core-http";
import { BlobServiceClient, StorageSharedKeyCredential } from "@azure/storage-blob";
import { assert } from "chai";

async function main() {
    const blobServiceClient = new BlobServiceClient("<Azurite-https-endpoint>", new StorageSharedKeyCredential("<account-name>", "<account-key>"));
    const serviceProperties = await blobServiceClient.getProperties();
    serviceProperties.minuteMetrics = {
        enabled: true,
        includeAPIs: true,
        retentionPolicy: {
            days: 366,
            enabled: true
        }
    }
    await blobServiceClient.setProperties(serviceProperties);
    await delay(5*1000);
    const result = await blobServiceClient.getProperties();
}

main().catch((err) => {
    assert.ok(err);
});

Expected Behavior: Azurite will return an error the same as Azure when set service properties with the invalid retention time.

@jongio for notification.

blueww commented 3 years ago

@zzhxiaofeng

Thanks for reporting this issue! We will look at it.

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

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.