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

Invalid filter comparison parameters do not generate InvalidRequest #78

Open
tjchambers opened this issue Feb 16, 2016 · 1 comment
Open
Labels

Comments

@tjchambers
Copy link
Contributor

By experimentation I have determined that an invalid filter comparison parameter is ignored without warning. The result is that the filter that was intended is not applied without notice to the client.

Example:

c = BlockScore::Person.all('create_at[gt]' => Time.now.to_i+1)

should in fact return an empty array. However it returns most recent 25 Persons because the create_at should be created_at. This could leave the impression that interface code is working when in fact it is NOT.

Note that this is in contrast to mistyping the actual comparison operator:

c = BlockScore::Person.all('created_at[gtx]' => Time.now.to_i+1)
BlockScore::InvalidRequestError: (Type: invalid_request_error) Received unknown filter directive: gtx (gtx) (Status: 400)

which DOES return a suitable message.

...and in contrast to bad filter parameters

c = BlockScore::Person.all('filter[name_second]' => 'valid')
BlockScore::InvalidRequestError: (Type: invalid_request_error) Received unknown filter parameter: name_second (name_second) (Status: 400)

which are acknowledged as invalid properly.

@tjchambers tjchambers added the bug label Feb 16, 2016
@tjchambers
Copy link
Contributor Author

@alain ping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant