mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 14:30:28 -05:00
* fix(dsql): refuse a startup packet or client message outside DSQL's limits The endpoint took a client message up to 64 MB and dropped the connection without a word past that; DSQL takes 10 MiB and answers FATAL 08P01 "invalid message length" as soon as a longer, or shorter than 4, length arrives. Measuring the startup packet alongside showed it one byte off as well: DSQL takes 9,999 bytes and answers "invalid length of startup packet" from 10,000, where the endpoint took 10,000 and refused more in silence. Both are DSQL's now, for the startup inside TLS, the password message and every message after signing in. What the database sends is not DSQL's to limit, so it is still read up to 64 MB. PostgresWire.checkedLength throws its own InvalidLengthException, still an IOException, so a reader can tell such a packet from a broken connection; the RDS proxy and Redshift's bridge end the connection on it as before. * fix(dsql): refuse any packet before TLS as not TLS, whatever its length The first head capped the packets read before TLS at the startup limit too, so a 10,000-byte plaintext startup packet, first or after a GSSENCRequest, closed the connection in silence where it had been refused as not TLS; above 10,000 bytes main closed in silence as well. Measured on DSQL, it reads no more than such a packet's length and code: a plaintext startup packet of any length is refused with "SSL is mandatory", and one under 8 bytes ends the connection without a word. The endpoint now reads the body only when it fits a startup packet, so the refusal reaches the client in order, and refuses a longer one unread.