Skip to content
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

Bugfix/consistent urlencoding #57

Merged
merged 2 commits into from
Dec 6, 2023

Conversation

Tib-z
Copy link

@Tib-z Tib-z commented Dec 6, 2023

#56

The proposed change is to "normalize" the url by calling getIntendedUrl() before calculating the signature in order to ensure the url is parsed the same way as it is returned after the final signature (appending the expires and signature query params). This way the url is url encoded consistently (special characters in the query params too).

Tests are added to validate this behaviour.

At the same time a test is added for a case when url includes reserved (expires and signature) query param keys. By design, these params are automatically overridden, that I think is the expected behaviour.
Before this change the validation always failed, because the signature was calculated on the full "raw" url including the reserved query params. However since the original query params are overridden the signature will never not match (at validation the signature is calculated without the reserved query params).

@freekmurze freekmurze merged commit 991ee9e into spatie:main Dec 6, 2023
3 checks passed
@freekmurze
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants