mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 11:06:06 +00:00
13e81c04ab
The database stores no NUL on either engine, but the application still held the value a client sent. A key or a check made from it was then a different value from the one the database compared: `victim@x.test` followed by NUL was a fresh key for the per-email password-reset throttle while the lookup found the victim's row, so every spelling mailed a new link and voided the last one. Every input now loses its NUL where it enters TREK: the nulFreeRequest middleware after the body parsers (path, query string, body, cookies), the first global pipe for what a route parses itself (a multipart body), the websocket adapter for every frame, and the MCP registry through a new host-supplied input mapper, since /mcp keeps its raw body. Headers need nothing: Node refuses a NUL in one with a 400. A string under a key naming a password stays as sent: it is only ever hashed, and stripping it would lock out an account whose password was set with one. The stripping in the database layer stays as the backstop for what does not come from a request.