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

Escape underscore wildcard for pg and mysql. #584

Conversation

IgorDobryn
Copy link
Contributor

Escape mysql/pg _ wildcard character.

@a-chumagin
Copy link

+1

jonatack added a commit that referenced this pull request Sep 8, 2015
Escape underscore wildcard for pg and mysql.
@jonatack jonatack merged commit 72612bd into activerecord-hackery:master Sep 8, 2015
@jonatack
Copy link
Contributor

jonatack commented Sep 8, 2015

Thanks!

jonatack added a commit that referenced this pull request Sep 10, 2015
@alkuzad
Copy link

alkuzad commented Jun 3, 2016

+1
@jonatack when this fix will be released ? It can be potentially dangerous

@ernie
Copy link
Contributor

ernie commented Jun 3, 2016

FWIW, back when I built Ransack leaving wildcard matching supported was intentional. I think I even used to have a screencast demoing it. ;)

@ernie
Copy link
Contributor

ernie commented Jun 3, 2016

But then, it was intended to be used for admin backends and the like. Folks seem to want to use it for more user-facing stuff than is wise.

@alkuzad
Copy link

alkuzad commented Jun 3, 2016

@ernie we faced that in LIKE statements (cont/end) when users can not match underscores, i.e foo_end:"_bar" will match anything that has bar at the end, not only the exact _bar

Great to know origins of this gem :) With the all that form helpers I always thought it's more user-oriented.

@jonatack
Copy link
Contributor

jonatack commented Jun 3, 2016

@ernie Interesting! Perhaps keep it as a config option, defaulting to 'safe'?

@alkuzad Yes, it's definitely time to cut a release. Until then, Ransack master works.

@ernie
Copy link
Contributor

ernie commented Jun 3, 2016

@jonatack Totally up to you. To be fair, wildcards can return unexpected data but I wouldn't necessarily call them "unsafe". @alkuzad's concern, however, is warranted, in that if someone doesn't understand how to use wildcards, they may get confusing results.

@alkuzad
Copy link

alkuzad commented Jun 3, 2016

@ernie even if all our users would be devs they would not be possible to escape them as slash is also escaped :)

@jonatack
Copy link
Contributor

jonatack commented Jun 3, 2016

Thanks, this provides useful perspective. My own use has been for admin backends only, and more focused on simplicity for the users and fast live response with punctuation stripped out anyway.

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.

5 participants