|
|
|
|
|
by jcranmer
3805 days ago
|
|
Plain text protocols suck. They give you the illusion of readability, and they can make what looks like the obvious solution turn out to be bug-ridden and rife with security holes. The readability is overrated--even in protocols like XML or JSON, most of the time I need to filter down to a small subset anyways, which requires me to write some sort of tool. And if you're already using a tool for all of your poking, what's the benefit to the input format? A good tag/length/value format (particularly when the tag implies how to interpret the value without needing to know a grammar, sorry ASN.1) is even easier to decode than a CRLF-based protocol, since you don't worry about things like "how long could this line be" or "does a bare LF count as a CRLF? What do I need to do for compatibility?" |
|
> If you're already using a tool
Often, I'm not.
> illusion of readability
That depends entirely on the protocol design; some are better than others. Binary protocol can also be a mess. More importantly, binary protocols will always require external definitions, while some text protocols do not.
> bug-ridden and rife with security holes
Changing from readable tokens and ASCIIified intege4rs to packed binary doesn't magically fix bus or security holes.
> what do I need to do for compatibility
That's easy: use the robustness principle[1].
(and most RFC-based protocols say you should send a CRLF).
A possible argument against this could...
> how long could this line be
...also be an argument against length fields. If you want reliable parsing - a very good idea - a good argument[2] can be made to only use context-free protocols (i.e. use parser-combinators).
[1] https://en.wikipedia.org/wiki/Robustness_principle
[2] https://media.ccc.de/v/28c3-4763-en-the_science_of_insecurit...