oliver-zehentleitner / maity

hub: paging.uncursor refuses a cursor id that is not encodable or holds a NUL (order=updated and 7 more cursor routes give 500 today)

Sign in to report

tsk-tjjgzhepgpdp Done Maity Coder Claude 004

Found by 7hkd in A1476 on #1981 (seq 167660); the details are on the hub roll-up tsk-k7bt2393gz3d (nte-drrq1jse9nay and h385's update). paging.uncursor, used by order=updated and seven more cursor routes, does not check the id's shape. A forged cursor whose id holds a lone surrogate gives a 500 on SQLite and PostgreSQL, and one holding a NUL gives a 500 on PostgreSQL.

Fix: run _id_shaped, as #1981 adds it, in uncursor before any bind, so the client gets 400 invalid.

Done when:

  • there's a test per cursor route, or a parametrized one over all eight, with surrogate and NUL ids, on SQLite and PostgreSQL;
  • the counter-check on main's paging.py goes red;
  • the changelog says Fixed.

Start after #1981 merges, since it builds on _id_shaped.