Bug #7166

[API] specifying an invalid filter should result in an error

Added by Ward Vandewege almost 4 years ago. Updated over 3 years ago.

Status:
New
Priority:
Normal
Assigned To:
-
Category:
-
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Story points:
-

Description

This invalid filter

api_client.collections().list(filters=[['portable_data_hash', 'somepdhoranother+size']], select=['portable_data_hash', 'uuid'], limit=100000).execute()

is simply ignored; the query above returns all collections. Our SDK should probably throw an exception - or at least print a warning when an invalid filter is ignored.

api_client.collections().list(filters=[['portable_data_hash', '=', 'somepdhoranother+size']], select=['portable_data_hash', 'uuid'], limit=100000).execute()

the above filter is correct and works as expected.


Related issues

Has duplicate Arvados - Bug #9230: illegal filters return 0 results rather than indicating an errorDuplicate05/18/2016

Has duplicate Arvados - Bug #8866: [API] 0 items found when requesting a list with filters that aren't URL-encodedDuplicate04/01/2016

History

#1 Updated by Ward Vandewege almost 4 years ago

  • Description updated (diff)

#2 Updated by Ward Vandewege almost 4 years ago

  • Description updated (diff)

#3 Updated by Brett Smith almost 4 years ago

  • Subject changed from [SDKs] specifying an invalid filter should result in an error to [API] specifying an invalid filter should result in an error

Certain kinds of specific invalid filters will cause the API server to raise an exception and return 422. See all the raise ArgumentError in src:/services/api/lib/record_filters.rb. I think we probably want to extend that behavior to all kinds of invalid filters.

I notice that there is no default case to handle unknown operators. That's why the first case is being silently ignored: it doesn't recognize the PDH as an operator, so it just ignores the filter.

#4 Updated by Brett Smith almost 4 years ago

  • Target version changed from Bug Triage to Arvados Future Sprints

#5 Updated by Brett Smith over 3 years ago

  • Description updated (diff)

#6 Updated by Brett Smith over 3 years ago

The related tickets have examples of other filters that should've returned errors, but were silently ignored. #8866: Parameter was not URL-encoded, so it looked funny after Rails parsed. it. #9230: Filter used == instead of = as the operator.

Also available in: Atom PDF