Files
floci/docs
Alessandro Lattao 564ae350a1 fix(dsql): refuse a startup packet or client message outside DSQL's limits (#6258)
* 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.
2026-10-22 16:53:06 -04:00
..
2026-03-15 17:43:56 -05:00