HF RL Explorer

REST API pagination: add validation

REST API pagination: add validation: a task in smol-software-harbor (Harbor dataset). A tampered cursor query parameter makes /orders crash with a random exception ( binascii.Error , JSONDecodeError , KeyError ...) or return odd pages for a negative offset. Make paginate in api/pages.py raise…

The task

A tampered `cursor` query parameter makes `/orders` crash with a random exception (`binascii.Error`, `JSONDecodeError`, `KeyError`...) or return odd pages for a negative offset. Make `paginate` in `api/pages.py` raise `ValueError("invalid cursor")` for any cursor that does not decode to an object with a non-negative…

Part of efederici/smol-software-harbor.