Skip to content

Spaces in parameter fields not supported #58

@samdammers

Description

@samdammers

Describe the bug
When attempting to filter the Workload catalogue using the Name property, including spaces causes a SigV4 Signature error under the hood.

ERROR:root:403: b'{"message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.\n\nThe Canonical String for this request should have been\n\'GET\n/20190206/workload-catalogue\nname=An%20item%20name\nhost:api.core.dev.juma.cloud\nx-amz-date:20200831T223119Z\nx-amz-security-token:IQoJb3JpZ2luX2VjEG8aDmFwLXNvdXRoZWFzdC0yIkcwRQIhAKnW51VZ/ptS9HVtZ8ipLOOSjjIPcXYZU6Ny5bhfSFTMAiAw5TCLB+owCJD7ol6QzbsDSVdC03IDv68n2VwlsDGopyriBAhoEAEaDDk4NDMyMTk3ODUzOSIMj6YJ9+vjJmc1LHBqKr8E2X89+7TANTvbMV26SJo7Wgw2i58ja5QzN02VrzpviWSVUlxJqKPxbmUT6eDB9RPS0SNcqn1GtIviCYdxDmpJXahP5nDUX99GKh6EW7pYoDR62/1kb70eyNtB2rljtnkgFxUS5kCpWehLRcgnYhAOb+MTWA0ShrYIHtTQrfYahWMAFzHLBnTlkka4SUoBSPcMQLDQ0ydibZLaLIdUlhgPmUR7bj9a8Q6sMOIRCBqlf9C3XZr+V/czDJkWVazZ0fHldkG1RVQVxd3494WOmdOntTpvkw9VT/fjGga8BcavqsPydSa+GwBJcM+yiX76lUlAUtx2lIoU70rWxpEZzkMduZ2qKtJW7TEasiyYg6GbjLC1x0qnSziI3DXE3N/iNRnNTtackYli+RbwYWyvj3/BF1cs2kUURa1OF8wQEQFUoz0NYFfeGjwpWuJ2MjaU7Q/F+5SX4pVg3he0/s8gJ3+AXTzL3ZU6kzXMx9y/AJTIfqmxxPM7W0BUzLr5rLdDKC5/Upwc16NsLHSPaIZjjvdad67FiS7qNH+3/eAqT6FsyOcZbj6Ypu2c/b6pEVq7w+erzpB8Pvp5z4KhDcXqW98ASJAnaf3ujqMc3P1zlLNuzkOCpjfdy4MQKxWPOrwSaHEvvoTcMfJhdWWCE6Ajrtafcq0Fn79ste/4oKBEHQypmCoWW4xnZrdiLzVbHyfgP2uMZQrwJTeQO1ghOgxU/h3IKIz8l0Spsl4bbUeb+G7Oz0WDrWEAKif1LuY3M22edj0wt/S1+gU6hQIZTNhaYf9dibVH3BEaDRrH2b956I+MwN4yFYDq+BwiuAbSnf1/FuuZ+kbcka9PO1mHMV6UOK+amDRdr71H5xz7OTkrUm3VJAHIXOBgaPYXw1cJPZqkko0K2/82ixMSUqTFEhbmwZub8/oqHCDKQz3KSQXgR0+5S8DJburTwCodjGkQu01FSsStwXH4249YVTAbIWRhY0JDufAaGC5vgecRoIPhrITWDsrNzaX3K3ijrYC9adMwBOjLIhATjoHEQK8/sEFB5wMHhLbDIREsqHwdSjwYSk3fCacT66LA781SX3N344jIyIeRLRp/CCGYBkoqqT2BFo4J17V8yRZTWhq5oQjCZ1g=\n\nhost;x-amz-date;x-amz-security-token\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\'\n\nThe String-to-Sign should have been\n\'AWS4-HMAC-SHA256\n20200831T223119Z\n20200831/ap-southeast-2/execute-api/aws4_request\n1a166bcff881b876bb13585d9b44d96f81240ea0c499449d13e31456341e2f53\'\n"}'
Traceback (most recent call last):
  File "/Users/sam/.pyenv/versions/3.7/lib/python3.7/site-packages/staxapp/api.py", line 35, in handle_api_response
    response.raise_for_status()
  File "/Users/sam/.pyenv/versions/3.7/lib/python3.7/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.core.dev.juma.cloud/20190206/workload-catalogue?name=An+item+name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".deployment/deploy_workload.py", line 16, in <module>
    name="An item name",
  File "/Users/sam/.pyenv/versions/3.7/lib/python3.7/site-packages/staxapp/openapi.py", line 128, in stax_wrapper
    ret = getattr(Api, paramter_path["method"])(path, payload)
  File "/Users/sam/.pyenv/versions/3.7/lib/python3.7/site-packages/staxapp/api.py", line 51, in get
    cls.handle_api_response(response)
  File "/Users/sam/.pyenv/versions/3.7/lib/python3.7/site-packages/staxapp/api.py", line 37, in handle_api_response
    raise ApiException(str(e), response)
staxapp.exceptions.ApiException: Api Exception: 403 Client Error: Forbidden for url: https://api.core.dev.juma.cloud/20190206/workload-catalogue?name=An+item+name

To Reproduce

import os
from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

client = StaxClient("workloads")
item = client.ReadCatalogueItems(
            name="An item name",
)

Expected behavior
Either a HTTP 404 or the specified catalogue that matches is returned

Environment Details (please complete the following information):

  • OS: MacOS
  • Python Version 3.7
  • Version StaxApp 1.0.4

Additional context
If I manually provide URL/ASCII encoding via %20 replacing spaces, the request is still not processed correctly, returning a 404 for a valid name. i.e. Workload "An item name" exists, passing in "An%20item%20name" returns 404

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions