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

sort_link Generates Link With URL's host Parameter if Present #1248

Closed
sshaw opened this issue Sep 9, 2021 · 2 comments · Fixed by #1317
Closed

sort_link Generates Link With URL's host Parameter if Present #1248

sshaw opened this issue Sep 9, 2021 · 2 comments · Fixed by #1317

Comments

@sshaw
Copy link

sshaw commented Sep 9, 2021

If you have a URL like: example.com?host=foo and you call sort_link on the page it will generate a URL for foo instead of example.com. This is a result of Rails' URL helpers but regardless SortLink#url_options should be scrubbing this and the other URL altering parameters.

Seeing this on 2.3.0 but from the code it looks to be a problem on master too.

The workaround is to params.delete(:host) before calling.

Related #693

@deivid-rodriguez
Copy link
Contributor

#1317 should fix this!

@phantomwhale
Copy link

phantomwhale commented Sep 15, 2022

I note the PR above fixed up host - which is a problem we are now seeing too (using an older version of the gem, beforer the patch above, to be clear)

Just wondered if there was a reason it didn't address the other URL altering parameters as well, as linked above?

(https://api.rubyonrails.org/classes/ActionDispatch/Routing/UrlFor.html#method-i-url_for)

Admittedly, overwriting host feels the most harmful - can't quite find an exploit for overwriting protocol yet

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 a pull request may close this issue.

3 participants