3 ms·
it depends on what type of safety. The schema language might for example allow you to specify that an input string/blob should be smaller than 10MB and refuse
by afiori 3y ago
it depends on what type of safety.
The schema language might for example allow you to specify that an input string/blob should be smaller than 10MB and refuse to deserialize it if it is longer, same for array/list/vector length.
- seangrogg 3y agoIt feels like a check against an input size of 10MB is something you would do well before deserialization, no?
- baq 3y agoYou would, but others might not. Defense in depth.
- afiori 3y agonot if it is a message you receive from a third party. A concrete example might be a batching third party client: the app sends N messages in a single batch and each message has its own size limit.
- tom_ 3y agoThe limit might apply to some specific part of the message, rather than the whole. You can't check this without actually deserialising, or at least doing most of the same work.
- signa11 3y ago> ... allow you to specify that an input string/blob should be smaller than 10MB and refuse to deserialize it if it is longer ... why ? are there no cases where serializing even larger file is valid ?
- afiori 3y agosure, a lot of cases, I suspect that S3 upload limits are different from imgur.
- signa11 3y agoand feel free to do that in _your_ application. don’t shackle others with the limitations of your domain. mechanism vs policy and all that.
- afiori 3y agoI believe I have already justified why it might be useful at the protocol/schema level in ways that cannot be replicated at the application level: to eagerly fail on expensive (eg memory) deserialization.