Service_SetProperties: Should report error when try to set more than 5 cors rules
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 393
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 36
Description
### Which service(blob, file, queue, table) does this issue concern?
blob
### Which version of the Azurite was used?
3.3.0-preview
### Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)
VS code
### What's the Node.js version?
v10.15.3
### What problem was encountered?
Service_SetProperties: Azurite don't report error when try to set more than 5 cors rules, this is not aligned with server.
HttpStatusCode: BadRequest
Error Code: InvalidXmlDocument
### Steps to reproduce the issue?
try to set more than 5 cors rules, and Azurite will success
### Have you found a mitigation/solution?
No
Test Case:
```
Test Name: CloudQueueTestValidCorsRules
Test FullName: Microsoft.Azure.Storage.Queue.QueueAnalyticsUnitTests.CloudQueueTestValidCorsRules
Test Source: C:\code\azure-storage-net\Test\ClassLibraryCommon\Queue\QueueAnalyticsUnitTests.cs : line 479
Test Outcome: Failed
Test Duration: 0:00:00.2870787
Result StackTrace:
at Microsoft.Azure.Storage.TestHelper.ExpectedException(Action operation, String operationDescription, HttpStatusCode expectedStatusCode, String requestErrorCode) in C:\code\azure-storage-net\Test\ClassLibraryCommon\TestHelper.cs:line 55
at Microsoft.Azure.Storage.Queue.QueueAnalyticsUnitTests.CloudQueueTestValidCorsRules() in C:\code\azure-storage-net\Test\ClassLibraryCommon\Queue\QueueAnalyticsUnitTests.cs:line 599
Result Message: Assert.Fail failed. No Storage exception received while expecting BadRequest: Services are limited to a maximum of five CORS rules.
```
Debug Log:
```
2019-12-20T02:11:17.990Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 info: QueueStorageContextMiddleware: RequestMethod=PUT RequestURL=http://127.0.0.1/devstoreaccount1?restype=service&comp=properties RequestHeaders:{"x-ms-client-request-id":"7d72fd2e-1e12-45a4-b14f-70dc28de0251","user-agent":"Azure-Storage/11.1.1 (.NET Core; Win32NT 6.2.9200.0)","x-ms-version":"2019-02-02","x-ms-date":"Fri, 20 Dec 2019 02:11:17 GMT","authorization":"SharedKey devstoreaccount1:/zCoJS9j4EJTcLwqBC8YnhXonpeqRh3ECu+A7bZF5xA=","content-length":"1763","host":"127.0.0.1:10001"} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1
2019-12-20T02:11:17.991Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 info: QueueStorageContextMiddleware: Account=devstoreaccount1 Queue=undefined Message=undefined MessageId=undefined
2019-12-20T02:11:17.991Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 verbose: DispatchMiddleware: Dispatching request...
2019-12-20T02:11:17.991Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 info: DispatchMiddleware: Operation=Service_SetProperties
2019-12-20T02:11:17.991Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 verbose: AuthenticationMiddlewareFactory:createAuthenticationMiddleware() Validating authentications.
2019-12-20T02:11:17.992Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 info: QueueSharedKeyAuthenticator:validate() Start validation against account shared key authentication.
2019-12-20T02:11:17.992Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 info: QueueSharedKeyAuthenticator:validate() [STRING TO SIGN]:"PUT\n\n\n1763\n\n\n\n\n\n\n\n\nx-ms-client-request-id:7d72fd2e-1e12-45a4-b14f-70dc28de0251\nx-ms-date:Fri, 20 Dec 2019 02:11:17 GMT\nx-ms-version:2019-02-02\n/devstoreaccount1/devstoreaccount1\ncomp:properties\nrestype:service"
2019-12-20T02:11:17.992Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 info: QueueSharedKeyAuthenticator:validate() Calculated authentication header based on key1: devstoreaccount1:/zCoJS9j4EJTcLwqBC8YnhXonpeqRh3ECu+A7bZF5xA=
2019-12-20T02:11:17.992Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 info: QueueSharedKeyAuthenticator:validate() Signature 1 matched.
2019-12-20T02:11:17.993Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 verbose: DeserializerMiddleware: Start deserializing...
2019-12-20T02:11:17.993Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 debug: deserialize(): Raw request body string is 1.0falsefalsefalsefalse1.0falsefalse1.0falsefalsewww.ab.com,www.bc.comGET,PUTx-ms-meta-data*,x-ms-meta-source*,x-ms-meta-abc,x-ms-meta-bcdx-ms-meta-data*,x-ms-meta-target*,x-ms-meta-xyz,x-ms-meta-foo500www.xyz.comGET0www.xyz.comGET,HEAD,POST,PUT,DELETE,TRACE,OPTIONS,CONNECT,MERGE0www.ab.comGETx-ms-meta-bcd0www.ab.comGETx-ms-meta-data*0
2019-12-20T02:11:17.994Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 info: HandlerMiddleware: DeserializedParameters={"options":{"requestId":"7d72fd2e-1e12-45a4-b14f-70dc28de0251"},"restype":"service","comp":"properties","version":"2019-02-02","storageServiceProperties":{"logging":{"version":"1.0","deleteProperty":false,"read":false,"write":false,"retentionPolicy":{"enabled":false}},"hourMetrics":{"version":"1.0","enabled":false,"retentionPolicy":{"enabled":false}},"minuteMetrics":{"version":"1.0","enabled":false,"retentionPolicy":{"enabled":false}},"cors":[{"allowedOrigins":"www.ab.com,www.bc.com","allowedMethods":"GET,PUT","allowedHeaders":"x-ms-meta-data*,x-ms-meta-target*,x-ms-meta-xyz,x-ms-meta-foo","exposedHeaders":"x-ms-meta-data*,x-ms-meta-source*,x-ms-meta-abc,x-ms-meta-bcd","maxAgeInSeconds":500},{"allowedOrigins":"www.xyz.com","allowedMethods":"GET","maxAgeInSeconds":0},{"allowedOrigins":"www.xyz.com","allowedMethods":"GET,HEAD,POST,PUT,DELETE,TRACE,OPTIONS,CONNECT,MERGE","maxAgeInSeconds":0},{"allowedOrigins":"www.ab.com","allowedMethods":"GET","exposedHeaders":"x-ms-meta-bcd","maxAgeInSeconds":0},{"allowedOrigins":"www.ab.com","allowedMethods":"GET","exposedHeaders":"x-ms-meta-data*","maxAgeInSeconds":0}]},"body":"ReadableStream"}
2019-12-20T02:11:17.995Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 verbose: SerializerMiddleware: Start serializing...
2019-12-20T02:11:17.995Z fb8fc6c7-2037-4984-bd04-ebbc4e9cf638 info: EndMiddleware: End response. TotalTimeInMS=5 StatusCode=202 StatusMessage=undefined Headers={"server":"Azurite-Queue/3.3.0-preview","x-ms-client-request-id":"7d72fd2e-1e12-45a4-b14f-70dc28de0251","x-ms-request-id":"fb8fc6c7-2037-4984-bd04-ebbc4e9cf638","x-ms-version":"2019-02-02"}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.