-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Waterline incorrectly sees search for as value of 'OR' as the 'OR' operator in some cases. #6977
Comments
@jpnarkinsky Thanks for posting! We'll take a look as soon as possible. In the mean time, there are a few ways you can help speed things along:
Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly. For help with questions about Sails, click here. |
@jpnarkinsky Many thanks for taking the time to report this - could you link us to a minimal repo that reproduces this error? Appreciate the fine details 👍 We'll have it examined further. |
@johnabrams7 @jpnarkinsky I, too, have hit this issue today and boy was I glad to see this post to let me know I wasn't going crazy. An additional observation/workaround I discovered: it is case-sensitive. So while something like
will throw the
will allow it to succeed. I use the sails-mysql adapter and MySQL queries are not case-sensitive, so this workaround is an easy path forward for me. |
I was able to reproduce this on the latest version on |
A workaround for this issue is wrapping the criteria in an array (e.g. |
I'm still experiencing this issue with |
Hi @tunicwriter, the changes in linked pull request are in |
@eashaw Looks like the issue has been corrected. Thank you! |
Node version: 12.16.1
Sails version (sails): 1.2.4
ORM hook version (sails-hook-orm): 2.1.1
Sockets hook version (sails-hook-sockets): n/a
Organics hook version (sails-hook-organics): n/a
Grunt hook version (sails-hook-grunt): n/a
Uploads hook version (sails-hook-uploads): n/a
DB adapter & version (e.g. sails-mysql@5.55.5): sails-postgres@1.0.2
Skipper adapter & version (e.g. skipper-s3@5.55.5): n/a
There appears to be a bug in waterline that can in some cases cause it to misinterpret an 'OR' in a value as an operator.
This code works as expected when searching with only the state.
It also works as expected when the state is not 'OR':
I believe the problem is to be found in sequelizer.js, and might have something to do with options.strip, but I couldn't find anything describing how to use those parameters so I didn't want to go any further with it than that since I've never used knex directly.
The text was updated successfully, but these errors were encountered: