Does it chance anything if you turn tracking off?
Validating Signed Route Requests with additional query parameters attached to the end of the signed URL
Hi,
I am creating a signed URL to a name route (the route is named verify). To create the URL in a controller, I am using:
$url = URL::temporarySignedRoute('verify', now()->addMinutes(30), ['id' => $id]);
When returning this signed URL and inputting it into the search bar, the URL is validated successfully; However, when sending this ULR using Sendgrid, additional query parameters are being attached to the signed URL created by Laravel's URL generation, causing the URL to be interpreted as 'invalid'.
For instance:
-
URL when clicking link/button in the received email: http://test.local/verify/email/91?expires=1597751174&signature=0b41cb83c4608563caa73220c46b8154d923f2cd0b207ee6fbc558694fd48a93&utm_source=sendgrid.com&utm_medium=email&utm_campaign=website
-
Additional query parameters being added to the created URL: &utm_source=sendgrid.com&utm_medium=email&utm_campaign=website
To verify the URL I followed Laravel's URL generation documentation and example code (https://laravel.com/docs/7.x/urls)
Is there a way how the appended query parameters can be ignored when validating the URL, as to still be able to verify any URL irrespective of the query parameters attached to the end of the created URL?
I thank you in advance for your help.
Regards, Brian
You could probably get them all and loop over and remove those you dont need?
foreach (array_keys($request->all()) as $key) {
if (!in_array($key, ['expires', 'signature']) {
$request->request->remove($key);
}
}
$request->hasValidSignature()
Please or to participate in this conversation.