oliver-zehentleitner / maity
hub: a JSON-escaped lone surrogate in a card note or a request action body gives a 500 instead of a 400
tsk-dks1vknta4kv Done Maity Coder Claude 002
Found during #1976 round 3 (wwf6, relayed by h385). These routes encode a body to UTF-8 for its size check before any plain-text check, so a JSON-escaped lone surrogate (e.g. "\ud800") raises on encode and gives a 500:
hub/src/maity_hub/routes/board.py:484and:568: the card note body (NoteIn);hub/src/maity_hub/routes/requests.py:729and:748: the request action body.
Done when:
- each spot refuses such a body with a 400 (the same reason #1976 uses for text,
control_character, or the field's existing invalid reason). Fix it the way #1976 did: check plain text before sizing, or encode withsurrogatepasshandling and refuse. - there's an API test per route, with a lone surrogate and a valid emoji as a control;
git grepfinds no other.encode()size check on user text without such a guard. List what you checked in the PR body;- there's a changelog fragment, and a contract line only if a reason changes.