Don't apply parsing of native_values to schema-validated values
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 437
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 15
Description
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
Contributor guide
Research direction
Start in kinto/core/resource/schema.py around lines 215-234 and reproduce the `/v1/buckets/default/collections/abcd/records?_since=` request, comparing the schema validation with the native-value parsing loop. The fix should prevent schema-described values such as `_since` from being re-added after being dropped, and clarify whether an empty `_since` should be dropped or raise an exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100