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

Add parameter filter capability for redirect locations #51131

Merged
merged 1 commit into from Feb 20, 2024

Conversation

tonytonyjan
Copy link
Contributor

Motivation / Background

This PR aims to complete an accepted pull request #21045 submitted 8 years ago because the author seems have no time keep working on it.

Detail

It uses the config.filter_parameters to match what needs to be filtered. The result would be like this:

Redirected to http://secret.foo.bar?username=roque&password=[FILTERED]

Also did rebase and improvement to make the code clearer.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

It uses the `config.filter_parameters` to match what needs to be
filtered. The result would be like this:

```
Redirected to http://secret.foo.bar?username=roque&password=[FILTERED]
```
@rafaelfranca rafaelfranca merged commit 05b4db2 into rails:main Feb 20, 2024
4 checks passed
gmcgibbon added a commit to gmcgibbon/rails that referenced this pull request Feb 23, 2024
rails#51131 introduced parameter filtering for redirects. We
didn't account for invalid URIs though, and it changes the behaviour of
redirect_to to raise URI errors when we try to filter a bad URI.
Instead, we should fallback to filtering bad URIs entirely to preserve behaviour.
jathayde pushed a commit to jathayde/rails that referenced this pull request Feb 28, 2024
rails#51131 introduced parameter filtering for redirects. We
didn't account for invalid URIs though, and it changes the behaviour of
redirect_to to raise URI errors when we try to filter a bad URI.
Instead, we should fallback to filtering bad URIs entirely to preserve behaviour.
gabriel-amaral pushed a commit to gabriel-amaral/rails that referenced this pull request Feb 29, 2024
rails#51131 introduced parameter filtering for redirects. We
didn't account for invalid URIs though, and it changes the behaviour of
redirect_to to raise URI errors when we try to filter a bad URI.
Instead, we should fallback to filtering bad URIs entirely to preserve behaviour.
Ridhwana pushed a commit to Ridhwana/rails that referenced this pull request Mar 7, 2024
rails#51131 introduced parameter filtering for redirects. We
didn't account for invalid URIs though, and it changes the behaviour of
redirect_to to raise URI errors when we try to filter a bad URI.
Instead, we should fallback to filtering bad URIs entirely to preserve behaviour.
viralpraxis pushed a commit to viralpraxis/rails that referenced this pull request Mar 24, 2024
rails#51131 introduced parameter filtering for redirects. We
didn't account for invalid URIs though, and it changes the behaviour of
redirect_to to raise URI errors when we try to filter a bad URI.
Instead, we should fallback to filtering bad URIs entirely to preserve behaviour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants