aws-sign4 icon indicating copy to clipboard operation
aws-sign4 copied to clipboard

Sort query parameters according to spec

Open fiddlerwoaroof opened this issue 7 years ago • 3 comments

AWS requests were failing in certain cases, the spec for canonicalizing the query string says:

Sort the parameter names by character code point in ascending order

This PR sorts only the names and not the name+value, which made the failing requests work. (e.g. use fukamachi's aws-sdk-lisp project to list all stacks and specify more than 9 statuses in the :stack-status-filter

fiddlerwoaroof avatar Jun 09 '18 06:06 fiddlerwoaroof

I guess I need to finish the tests...

fiddlerwoaroof avatar Jun 10 '18 07:06 fiddlerwoaroof

The documentation says that query parameters should only be sorted by names, but the test suite does indeed have a test expecting the values to be used for sorting too. See get-vanilla-query-order-value. I've updated to the latest version of the test suite. That test is still there.

I suspect the problem with aws-sdk-lisp is something else. I was not able to load :aws-sdk/services/cloudformation (got error: no symbol named "INCLUDE-EMPTY-SECTIONS?" in "PARSER.INI"). Do you have an example of what parameters create-canonical-request is called with?

bakketun avatar Jun 19 '18 15:06 bakketun

Here's an example without my fix applied:

(AWS-SIGN4:CREATE-CANONICAL-REQUEST
 :POST "/"
 "Action=ListStacks&StackStatusFilter.member.1=UPDATE_COMPLETE&StackStatusFilter.member.10=CREATE_IN_PROGRESS&StackStatusFilter.member.11=DELETE_IN_PROGRESS&StackStatusFilter.member.12=DELETE_FAILED&StackStatusFilter.member.2=UPDATE_IN_PROGRESS&StackStatusFilter.member.3=UPDATE_COMPLETE_CLEANUP_IN_PROGRESS&StackStatusFilter.member.4=UPDATE_ROLLBACK_COMPLETE&StackStatusFilter.member.5=UPDATE_ROLLBACK_IN_PROGRESS&StackStatusFilter.member.6=UPDATE_ROLLBACK_FAILED&StackStatusFilter.member.7=UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS&StackStatusFilter.member.8=CREATE_FAILED&StackStatusFilter.member.9=CREATE_COMPLETE"
 '(("host" "cloudformation.us-west-2.amazonaws.com")
   ("x-amz-date" "20180625T190057Z"))
 "host;x-amz-date"
 "")```

fiddlerwoaroof avatar Jun 25 '18 19:06 fiddlerwoaroof