oliver-zehentleitner / maity

hub: a client key echoed into details.fields can break the error envelope (lone surrogate gives 500); escape field paths centrally

Sign in to report

tsk-6kgkqmkxzy76 Cancelled

Follow-up of #1987 (tsk-dks1vknta4kv). Several hand-written validators put a key the client sent into details.fields. A key holding a lone surrogate ("\ud800") then makes the error answer fail while it is encoded (errors.py about line 56), so the client gets a 500 instead of a 400. #1987 fixed this per route for the language keys. These sites are still open, found by reading the code and not yet confirmed with a probe:

  • landing: top-level extra_forbidden and variant slugs;
  • auth pages: extra_forbidden for an unknown name, page or text key;
  • legal: extra_forbidden;
  • site_values.refuse_placeholders, which walks the raw body.

Done when:

  • the error envelope escapes or replaces any field path it cannot encode, centrally in errors.py, so no client key can break it;
  • the per-route fixes from #1987 stay;
  • there is a test per site with a probe body (raw JSON with \ud800 in a key), plus one generic test against the envelope;
  • the contract (§1.x error envelope) says how such a path is rendered, if it changes what a client sees.