Kinto / kinto

A generic JSON document store with sharing and synchronisation capabilities.
http://docs.kinto-storage.org/
Other
4.33k stars 422 forks source link

Don't apply parsing of native_values to schema-validated values #1503

Open glasserc opened 6 years ago

glasserc commented 6 years ago

Despite being validated at https://github.com/Kinto/kinto/blob/master/kinto/core/resource/schema.py#L234, making a request such as /v1/buckets/default/collections/abcd/records?_since= passes an empty string ("") to the backend (see e.g. #1305 and #1502). This appears to be due to https://github.com/Kinto/kinto/blob/master/kinto/core/resource/schema.py#L215-L222, which tries to parse any leftover fields as "native values". Unfortunately, this applies to all values, and although _since has already been dropped by this point, it gets re-added by this loop. This loop should probably only apply to values that are not already described by the schema.

Another question is why _since="" is turned into a colander.drop and not an exception?

/cc @gabisurita

leplatrem commented 6 years ago

Notes: Maybe related: https://github.com/Pylons/colander/pull/199 https://github.com/Pylons/colander/issues/214

Also, if we end-up fixing this, we should remove what was done in #1502