3 ms·
It's a tough balance. Postel's law is from a world before security mattered. It is incompatible with correctness. The early Internet definitely wouldn't have
by jrockway 3y ago
It's a tough balance. Postel's law is from a world before security mattered. It is incompatible with correctness.
The early Internet definitely wouldn't have worked without a thick layer of "you set this flag wrong in the header but I know what you meant". But these liberal formats have been the death of many a "0 remote root holes in the default install" OS slogan ;)
Git, meanwhile, would be something like:
$ git clone example.com/cool-code
FATAL: commit abc123: 2 errors:
header.author: too many authors in header
header.author[0]: empty friendly name
checkout aborted, contact the upstream git repo and tell 'em it's broke
People would be mad and would stop using Git, so "git clone" has to accept whatever.
But the signature generating-code doesn't need to be this liberal; it can run this validation and say "I'm not going to sign that", and nobody would be mad. Github's implementation is just a shortcut; some engineer tried their flow against a test commit they made, it worked, they checked it in, they shipped the feature. Then someone thought "what if there are two author lines", and broke the signing code. (Maybe write some fuzz tests that emit headers and try signing them? You might not find this bug, but it can help.)
The problem is the missing spec, but specs are useless if not enforced, because people won't know that they accidentally violated the spec. That's what's tough. Postel's Law guarantees working software. But sometimes working means failing open. (Failing closed can definitely suck. Ever been late to work because of a "signal problem"? The signalling system failed closed and prevented your train from moving even though there wasn't any actual reason to prevent movement. Postel's Law would say "it's just a burned out light bulb; power ahead at line speed, not expecting a train randomly misrouted and barreling into you head on". 99.9% of the time, it's right! But there are a lot of dead 0.1%-ers, which is after the early days, we decided to make the system fail closed.)