Giter Club home page Giter Club logo

Comments (4)

arafato avatar arafato commented on July 16, 2024

@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.
So what is the semantics of a missing expiry date? Infinite validity? Any ideas?

from azurite.

nobiehl avatar nobiehl commented on July 16, 2024

@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}

from azurite.

edwin-huber avatar edwin-huber commented on July 16, 2024

@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.

from azurite.

edwin-huber avatar edwin-huber commented on July 16, 2024

Issue is resolved, but we want to ensure that we have behavioral parity with Azure storage for the case of malformed XML.
Creating a new issue for that.

from azurite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.