Skip to content

[12.x] Ignore querystring parameters using closure when validating signed url #54104

Merged
taylorotwell merged 1 commit into
laravel:masterfrom
gdebrauwer:hasvalidsignature-ignorequery-closure
Jan 7, 2025
Merged

[12.x] Ignore querystring parameters using closure when validating signed url #54104
taylorotwell merged 1 commit into
laravel:masterfrom
gdebrauwer:hasvalidsignature-ignorequery-closure

Conversation

@gdebrauwer

Copy link
Copy Markdown
Contributor

If you want to ignore all utm querystring parameters when validating a signed url, you currently have to provide all those utm parameters in an array:

$request->hasValidSignatureWhileIgnoring(['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'])

This PR makes that easier by allowing you to provide a closure to determine which querystring parameters should be ignored:

$request->hasValidSignatureWhileIgnoring(fn ($parameter) => Str::startsWith($parameter, 'utm_'));

@gdebrauwer gdebrauwer changed the title [12.x] Ignore querystring parameters using closure when validating url signature [12.x] Ignore querystring parameters using closure when validating signed url Jan 7, 2025
@taylorotwell taylorotwell merged commit 7691c66 into laravel:master Jan 7, 2025
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