Skip to content

CloudFrontSigner doesn't account for wildcard question marks #3377

@WeatherGod

Description

@WeatherGod

CloudFrontSigners can be used to sign an url with '*' and '?' wildcards: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-setting-signed-cookie-custom-policy.html#private-content-custom-policy-statement-cookies-values. The check in _build_url() to figure out whether it is adding a query or appending to an existing query string does not account for this and can result in incorrect results. For example, consider the url "https://example.com/example_202?.zip". Rather than being modified with a new query string "https://example.com/example_202?.zip?SomeParam=foo", it'll be incorrectly turned into "https://example.com/example_202?.zip&SomeParam=foo".

I'm not exactly sure how this should (if at all) be fixed because the wildcard is in direct contradiction with url specs. At the moment, we are working around it by detecting that a wildcard was used and swapping out the first '&' for a '?', but this only works in our case because we know there aren't any query strings to start with with our particular URLs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a confirmed bug.cloudfrontfeature-requestThis issue requests a feature.p3This is a minor priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions