-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
**PANIC** while creating storage container policy #12
Comments
@nobiehl thanks for reporting! Confirmed as bug. Azurite wrongly expects a value for start and expiry date. While I see in the spec that start date is optional (set to immediate) , expiry date seems to be required. Your request is, however, valid when executed against Azure Storage. |
@arafato I couldn't find any specific information about the duration, if no expiry date is provided. But I figured out that if no expiry is provided when creating a policy the validity of the creates SAS tokens seem to be infinity. From my point of view it seems plausible. I tested it with the sorage account emulator, on azure and even on Azurite. Here is my test script: #!/bin/bash
# docker run --rm -p 10001:10001 -d arafato/azurite:2.6.5
ADD_DATE=false
if [ ! -z ${1} ]; then
# set to true when using azurite
ADD_DATE=true
fi
export AZURE_STORAGE_CONNECTION_STRING=\
'QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;'\
'DefaultEndpointsProtocol=http;'\
'AccountName=devstoreaccount1;'\
'AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;'
QUEUE_NAME="test-queue-1"
POLICY_NAME_WRITE="test-write"
PERMISSIONS_WRITE='a'
POLICY_NAME_READ="test-read"
PERMISSIONS_READ="rp"
MESSAGE='{"name":"klaus"}'
START=$(date "+%Y-%m-%d")
EXPIRY=$(date "+%Y-%m-%d" -d "$end_date+1 day")
DELETED=$(az storage queue delete --name ${QUEUE_NAME} --query deleted 2>&-)
if [ "${DELETED}" == "true" ]; then
echo "Waiting until the queue is deleted ..."
sleep 30
fi
az storage queue create --name ${QUEUE_NAME}
# WRITE MESSAGE POLICY
CREATE_POLICY_WRITE="az storage queue policy create --name ${POLICY_NAME_WRITE} --queue-name ${QUEUE_NAME} --permissions ${PERMISSIONS_WRITE}"
CREATE_POLICY_READ="az storage queue policy create --name ${POLICY_NAME_READ} --queue-name ${QUEUE_NAME} --permissions ${PERMISSIONS_READ}"
if [ "${ADD_DATE}" = "true" ]; then
CREATE_POLICY_WRITE="$CREATE_POLICY_WRITE --start ${START} --expiry ${EXPIRY}"
CREATE_POLICY_READ="$CREATE_POLICY_READ --start ${START} --expiry ${EXPIRY}"
fi
( # RUN
set -x
${CREATE_POLICY_WRITE}
${CREATE_POLICY_READ}
)
# READ MESSAGE AND PROCESS MESSAGES POLICY
az storage queue policy create --name ${POLICY_NAME_READ} --queue-name ${QUEUE_NAME} --permissions "${PERMISSIONS_READ}"
SAS_WRITE=$(az storage queue generate-sas --name ${QUEUE_NAME} --policy-name ${POLICY_NAME_WRITE})
SAS_READ=$(az storage queue generate-sas --name ${QUEUE_NAME} --policy-name ${POLICY_NAME_READ})
# ADD A MESSAGE
az storage message put --queue-name "${QUEUE_NAME}" --content "${MESSAGE}" --sas-token "${SAS_WRITE//'"'/}"
# GET MESSAGE
CONTENT=$(az storage message get --queue-name "${QUEUE_NAME}" --sas-token "${SAS_READ//'"'/}")
MESSAGE_ID=$(echo ${CONTENT} | jq -r .[0].id)
POP_RECEIPT=$(echo ${CONTENT} | jq -r .[0].popReceipt)
# DELET MESSAGE
az storage message delete --queue-name "${QUEUE_NAME}" --sas-token ${SAS_READ//'"'/} --id ${MESSAGE_ID} --pop-receipt ${POP_RECEIPT}
|
@nobiehl thanks for reporting this and the detailed repro steps. I'm picking up where @arafato left off, and I'll add this to the list that we are working on addressing. We're currently reviewing all the security issues raised in the projects dependencies, and deciding on how to address those, once that is complete, I hope to catch up on the outstanding issues. |
Address issue **PANIC** while creating storage container policy #12
Issue is resolved, but we want to ensure that we have behavioral parity with Azure storage for the case of malformed XML. |
Address issue **PANIC** while creating storage container policy Azure#12
Hi,
I'm using azurite version: 2.6.5 in a docker container on Windows 10 and docker-ce in WSL bash.
When I try to create a storage container policy with:
export AZURE_STORAGE_CONNECTION_STRING=BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
docker run --rm -d -p 10000:10000 arafato/azurite:2.6.5
az storage container create --name test
az storage container policy create --name read --permission rl --container-name test
I'm getting the following error:
PUT /devstoreaccount1/test?restype=container&timeout=30 201 9.546 ms - 0
GET /devstoreaccount1/test?comp=acl&restype=container 200 6.874 ms - 59
PANIC Something unexpected happened! Blob Storage Emulator may be in an inconsistent state!
TypeError: Cannot read property '0' of undefined
at parseStringAsync.then (/opt/azurite/lib/xml/Serializers.js:19:81)
at tryCatcher (/opt/azurite/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/opt/azurite/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/opt/azurite/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/opt/azurite/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/opt/azurite/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/opt/azurite/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues [as _onImmediate] (/opt/azurite/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:763:18)
at tryOnImmediate (timers.js:734:5)
at processImmediate (timers.js:716:5)
PANIC Something unexpected happened! Blob Storage Emulator may be in an inconsistent state!
TypeError: Cannot read property '0' of undefined
at parseStringAsync.then (/opt/azurite/lib/xml/Serializers.js:19:81)
at tryCatcher (/opt/azurite/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/opt/azurite/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/opt/azurite/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/opt/azurite/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/opt/azurite/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/opt/azurite/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues [as _onImmediate] (/opt/azurite/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:763:18)
at tryOnImmediate (timers.js:734:5)
at processImmediate (timers.js:716:5)
PANIC Something unexpected happened! Blob Storage Emulator may be in an inconsistent state!
TypeError: Cannot read property '0' of undefined
at parseStringAsync.then (/opt/azurite/lib/xml/Serializers.js:19:81)
at tryCatcher (/opt/azurite/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/opt/azurite/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/opt/azurite/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/opt/azurite/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/opt/azurite/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/opt/azurite/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues [as _onImmediate] (/opt/azurite/node_modules/bluebird/js/release/async.js:17:14)js:17:1
4)
at Immediate.Async.drainQueues [as _onImmediate] (/opt/azurite/node_modules/bluebird/js/release/async
.js:17
:14)
at runCallback (timers.js:763:18)
at tryOnImmediate (timers.js:734:5)
at Immediate.Async.drainQueues [as _onImmediate] (/opt/azurite/node_modules/bluebird/js/release/async
.UT /devstoreaccount1/test?comp=acl&restype=container - - ms - -
js:17:14)
at runCallback (timers.js:763:18) ) at tryOnImmediate (timers.js:734:5)
at processImmediate (timers.js:716:5)
PUT /devstoreaccount1/test?comp=acl&restype=container - - ms - - )
PANIC Something unexpected happened! Blob Storage Emulator may be in an inconsistent state! js:17:14TypeError: Cannot read property '0' of undefined .
at parseStringAsync.then (/opt/azurite/lib/xml/Serializers.js:19:81)
at tryCatcher (/opt/azurite/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/opt/azurite/node_modules/bluebird/js/release/promise.js:512:31
) at Immediate.Async.drainQueues [as _onImmediate] (/opt/azurite/node_modules/bluebird/js/release/async
at Promise._settlePromise (/opt/azurite/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseFromHandler (/opt/azurite/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/opt/azurite/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/opt/azurite/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/opt/azurite/node_modules/bluebird/js/release/async.js:138:12) at Async._drainQueues (/opt/azurite/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues [as _onImmediate] (/opt/azurite/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:763:18) at tryOnImmediate (timers.js:734:5)
at processImmediate (timers.js:716:5)
PANIC Something unexpected happened! Blob Storage Emulator may be in an inconsistent state!
TypeError: Cannot read property '0' of undefined
at parseStringAsync.then (/opt/azurite/lib/xml/Serializers.js:19:81)
at tryCatcher (/opt/azurite/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/opt/azurite/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/opt/azurite/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/opt/azurite/node_modules/bluebird/js/release/promise.js:606:10) at Async._drainQueue (/opt/azurite/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/opt/azurite/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues [as _onImmediate] (/opt/azurite/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:763:18)
at tryOnImmediate (timers.js:734:5)
at processImmediate (timers.js:716:5)PUT /devstoreaccount1/test?comp=acl&restype=container - - ms - -
PUT /devstoreaccount1/test?comp=acl&restype=container - - ms - -
PUT /devstoreaccount1/test?comp=acl&restype=container - - ms - -
PUT /devstoreaccount1/test?comp=acl&restype=container - - ms - -
The text was updated successfully, but these errors were encountered: