You can also limit the wider process or system your request is part of.
Time limits tend to also defacto limit size, if bandwidth is somewhat constrained.
Timeouts and size limits are trivial to update as legitimate need is discovered.
Practically speaking, putting an arbitrary size limit somewhere is like putting yet-another-ssl-cert-that-needs-to-be-renewed in some critical system. It will eventually cause an outage you aren’t expecting.
Will there be a plausible someone to blame? Of course. Realistically, it was also inevitable someone would forget and run right into it.
Time limits tend to not have this issue, for various reasons.
I found a fix for this some years back:
openssl req -x509 -days 36500No, not at all. A TLS cert that expires takes the whole thing down for everyone. A size limit takes one operation down for one user.
Eg if you fork for every request, that process only serves that one user. Or if you can restart fast enough.
I'm mostly inspired by Erlang here.