-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Breaking change in PR #37432 #37543
Comments
But that url doesn't matches the signed url. It totally defeats the purpose of a signed url and is exposed to security vulnerabilities. Surely you can't expect that to ever have been the expected scenario? |
What exactly is keeping you from appending the query param before signing the url? |
We definitely didn't consider that use case, and we could perhaps add logic to detect such duplicated parameters, but one way to look at it is that this is precisely what a signed URL should detect and reject. Any deviation from verifying the actual raw data might introduce a vulnerability. For instance, perhaps the order of the parameters matter in some weird implementation, and then being able to append a duplicated parameter should be prevented. |
I completely agree it is a very hacky solution. However it was supported and now it is not, so I figured it might be good to mention it so you could make an informed decision whether it the pr should not be put into Laravel 9x instead of 8x. For the record I agree that it would be better if future versions of Laravel would not support this :). I am not so sure about the security implications actually. The project has testing that ensures that changing the query param to anything else still failed validation. The query string is already in the signed url. The problem is that the payment provider adds the exact same query param once more. So I could add it once more , but then they would do the same. So there would always be 1 (duplicate query param to many). I guess I could probably strip they unneeded extra query param before it gets picked up by the signed middleware. |
Could you not generate a signed URL for the double parameter, and then remove one occurrence before giving them then URL? They will then append back the extra parameter and make the signature valid again. |
Thanks that is probably the cleanest solution! |
I realized now that that may actually not work, since the signer probably ignores the double parameter. You could of course still generate the valid |
Ah no, you actually can't because you pass an assoicative array to the signed url, so you cannot have the same key twice . |
If it is indeed a manual process, feel free to send me an email of help with generating a valid Edit: And of course the And then append the query parameter $signature. |
Since we only gotten one report so far and there's a workaround, I'm going to close this. We could maybe revisit if lots of other people run into this but for now I think the PR was valid. Thanks for reporting though. |
In case somebody else finds this while searching for a solution (like I did)...
This no longer works after this update. Now, the solution looks like this:
|
@sublime392 Support for that use case has been added to 9.x Perhaps you could utilize that update locally until then, here's a relevant commit (more details around this commit): |
Description:
I think PR #37432 introduced a breaking change.
Before the PR you could create a signed url like:
https://foo.bar.net/success/5e1564b9-26ce-4a49-95e2-43644e1d7d5f?transactionid=5e1564b9-26ce-4a49-95e2-43644e1d7d5f
And then you could go to that url with the query param duplicated (note transactionid is in there twice):
https://foo.bar.net/success/5e1564b9-26ce-4a49-95e2-43644e1d7d5f?transactionid=5e1564b9-26ce-4a49-95e2-43644e1d7d5f&transactionid=5e1564b9-26ce-4a49-95e2-43644e1d7d5f
And this would pass the hasCorrectSignature method. Now it has become invalid.
I know it seems like a stupid scenario but we actually have a payment provider that adds the transactionid to the query string whether you want them to or not.
Steps To Reproduce:
Create a signed Url with a query param.
Then go to that signed url and manually duplicated your query param.
The text was updated successfully, but these errors were encountered: