News for hackers. Stuff that matters.
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by stackghost on Tuesday September 24, 2024 @10:08AM (#41636611)
"Postel" is not a term that carries any significance for me, and Googling that word didn't turn anything up that seemed relevant.

Who or what is a Postel?

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by Ndymium on Tuesday September 24, 2024 @10:12AM (#41636645)
It's a reference to Jon Postel who wrote the following in RFC 761[0]:

    TCP implementations should follow a general principle of robustness:
    be conservative in what you do, be liberal in what you accept from
    others.
Postel's Law is also known as the Robustness principle. [1]

[0] https://datatracker.ietf.org/doc/html/rfc761#section-2.10

[1] https://en.wikipedia.org/wiki/Robustness_principle

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by arcanemachiner on Tuesday September 24, 2024 @12:14PM (#41638123)
I've always felt that this was a misguided principle, to be avoided when possible. When designing APIs, I think about this principle a lot.

My philosophy is more along the lines of "I will begrudgingly give you enough rope to hang yourself, but I won't give you enough to hang everybody else."

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by quesera on Tuesday September 24, 2024 @12:56PM (#41638505)
HTML parsing is the modern-ish layer-uplifted example of liberal acceptance.

I won't argue that this hasn't been a disaster for technologists, but there are many arguments that this was core to the success of HTML and consequently the web.

Which, yes, could be considered its own separate disaster, but here we are!

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by pas on Tuesday September 24, 2024 @06:21PM (#41641584)
It makes sense in a "costumer obsessed" way. The user agent tries to show content, tries to send requests and receive the response on behalf of the client (costumer), and ceteris paribus it's better for the client if the system works even if there's some small error that can be worked around, right?

but of course this leads to the tragedy of anticommons, too many people have an effective "veto" (every shitty middlebox, every "so easy to use" 30 line library that got waaay to popular now contributes to ossification of the stack.

what's the solution? similarly careless adoption of new protocols? and hoping for the best? maybe putting an emphasis on provable correctness, and if something is not conformant to the relevant standard then not considering it "broken" for the "if it ain't broken don't touch it" principle?

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by joshstrange on Wednesday September 25, 2024 @08:52AM (#41646886)
When it comes to writing APIs I feel strongly that you should be incredibly strict.

1 != ‘1’

true != 1

true != ‘true’

undefined != false

undefined != null

etc

“Flexibility” in your API just means you are signing up for a maintenance burden for the lifetime of your API. You will also run into problems because you have to draw the line somewhere and people will be frustrated/confused since your API is “flexible” but not as flexible as they want. Better to draw the line at complete strictness IMHO. I dislike even optional fields and prefer null to be passed instead except special cases (like when null has a meaning, example: search endpoint where you pass the fields you want to search on and a field can have a null value).

I want people to be explicit about what they are doing/fetching when using an API I have written/maintained. It also encourages less sloppy clients

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by IshKebab on Tuesday September 24, 2024 @02:47PM (#41639682)
Ironically it leads to less robust systems in the long term.
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by thaumasiotes on Tuesday September 24, 2024 @04:12PM (#41640419)
> Postel's Law is also known as the Robustness principle.

Really? It seems like it's obviously just a description of how natural language works.† But in that case, there's an enforcement mechanism (not well understood) that causes everyone to be conservative in what they send.

We can observe, by the natural language 'analogy', that the consequence of following this principle is that you never have backwards compatibility. Otherwise things generally work.

† Notably, it has nothing to do with how math works, making it a strange choice for programming.

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by komon on Tuesday September 24, 2024 @10:13AM (#41636663)
A reference to Postel's Law: be conservative in what you produce and liberal in what you accept.

The law references that you should strive to follow all standards in your own output, but you should make a best effort to accept content that may break a standard.

This is useful in the context of open standards and evolving ecosystems since it allows peers speaking different versions of a protocol to continue to communicate.

The assertion being made here is that the world has become too fraught with exploiting this attitude for it to continue being a useful rule

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by godshatter on Tuesday September 24, 2024 @10:28AM (#41636818)
What would have been the result of John Postel advocating for conservative inputs, I wonder? I'm wondering if the most common protocols would have been bypassed if they had all done this by other protocols that allowed more liberal inputs.
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by Joker_vD on Tuesday September 24, 2024 @10:31AM (#41636848)
Yep. Which is why Postel law is, sadly, more like a law of nature (see also "worse is better") than an engineering principle you may or may not follow.
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by mrighele on Tuesday September 24, 2024 @10:46AM (#41637051)
I know it is a single example and we should extrapolate much out of it, but in the case of html those who accepted more liberal input (html4/5) won over over those that were more conservative (xhtml).
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by 0cf8612b2e1e on Tuesday September 24, 2024 @11:56AM (#41637946)
I would almost argue a failing of so many standards is the lack of surrounding tooling. Is this implementation correct? Who knows! Try it against this other version and see if they kind of agree. More specifications need to require test suites.
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by jancsika on Tuesday September 24, 2024 @11:33AM (#41637655)
Am I correct that malformed pages in xhtml would have triggered the browser to output a red XML error and fail to render the page at all?
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by Calavar on Tuesday September 24, 2024 @12:07PM (#41638061)
Yes, but only if you served the XHTML with the proper MIME type of application/xhtml+xml. Nearly everyone served it as text/html, which would lead to the document being intepreted as this weird pseudo XHTML/HTML4 hybrid dialect with all sorts of brower idiosyncrasies [1].

[1] https://www.hixie.ch/advocacy/xhtml

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by edflsafoiewq on Tuesday September 24, 2024 @12:13PM (#41638112)
Not really, since in the end HTML5 defined a precise parsing algorithm that AFAIK everyone follows.
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by quesera on Tuesday September 24, 2024 @01:10PM (#41638684)
HTML5 was born in an era of decent HTML authoring tooling. Very few people write HTML by hand nowadays. This was not true of earlier versions.

Also note that HTML5 codified into liberal acceptance some of the "lazy" manual errors that people made in the early days (many of which were strictly and noisily rejected in XHTML, for example).

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by duskwuff on Wednesday September 25, 2024 @03:53AM (#41644876)
The overwhelming complexity of the HTML5 parser [1] is a testament to the 30 years of implementation quirks it's been forced to absorb.

[1]: https://html.spec.whatwg.org/multipage/parsing.html

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by mikaraento on Tuesday September 24, 2024 @01:02PM (#41638578)
RFC 9413 referenced in a parent mentions HTML. It points out that formats meant to be human-authored may benefit more from being liberally accepted.

I also read that XHTML made template authoring hard, as the template itself might not be valid XHTML and/or different template inputs might make output invalid. (I sadly can't find the source of this point right now, but I can't claim credit for it).

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by int_19h on Wednesday October 02, 2024 @09:28PM (#41726479)
I don't recall XHTML being harder to generate from PHP and ASP templates. It's largely down to making sure that all tags in the output are always balanced, which isn't difficult at all.

With PHP specifically there was an issue where the use of shorthand <? syntax for code snippets would conflict with <?xml declaration that would normally be placed at the beginning of the XHTML document - it would see the <? and try to interpret the rest of it as PHP code, which obviously didn't work. The workaround was to disable short tags and always use <?php explicitly

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by arp242 on Tuesday September 24, 2024 @05:11PM (#41640949)
HTML is rather different because it's authored by people. It's typically (though not always!) a good idea to not be too pedantic about accepting user input if you can. XHTML (served with the correct Content-Type) will completely error out if you made a typo and didn't test carefully enough. Useful in dev cycle? Sure. In production? Less so. "The entire page goes tits up because you used <br> instead of <br />" is just not helpful (and also: needlessly pedantic).

But that doesn't really apply to protocols like TCP. Postel's "law" is best understood in the context of 1980, when TCP had been around for a while but without a real standard, everyone was kind of experimenting, and there were tons of little incompatibilities. In this context, it was reasonable and practical advice.

For a lot of other things though: not so much. "Fail fast" is typically the better approach, which will benefit everyone, especially the people implementing the protocols.

This is also why Sendmail became the de-facto standard around the same time by the way: it was bug-compatible with everything else. Later this become a liability (sendmail.cf!), but originally it was a great feature.

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by miki123211 on Tuesday September 24, 2024 @12:59PM (#41638546)
Probably more convoluted protocols, because there are always things that you do accept and that can be used to negotiate protocol extensions.

Imagine a protocol where both sides have to speak JSON with a rigidly-defined structure, and none of the sides is allowed to ask whether the other supports any extension. Such a protocol looks impossible to extend, but that is not the case, you can indicate that you speak a "relaxed" version of that protocol by e.g. following your first left brace by a predefined, large number of whitespace characters. If you see a client doing this, you know they won't drop the connection if you include a supported_extensions field, and you're still able to speak the rigid version to strict clients.

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by quesera on Tuesday September 24, 2024 @01:07PM (#41638649)
This made me laugh, because it's even more terrible than the most ridiculous chicanery we had to vomit into HTML and CSS over the years (most of which was the fault of MSIE6).
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by ok123456 on Tuesday September 24, 2024 @10:46AM (#41637056)
The fact that googling Postel was worthless also indicates we're in a post-google search world.
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by skybrian on Tuesday September 24, 2024 @12:04PM (#41638023)
Google’s results for “Postel’s law” and “Jon Postel” are fine. “Postel” is ambiguous, a fairly common surname, so websites of unrelated companies show up, and a disambiguating page on wikipedia that links to Jon Postel and several other people.
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by ok123456 on Tuesday September 24, 2024 @12:17PM (#41638146)
I thought the whole point of letting Google surveil your entire life was they would know that if you're interested in computing and networks, to the point of participating on news.hackernews.com, then they'd know that if you're searching for "Postel," you'd probably want Postel's law to be on the first page.

We're back at pre-1998 search, where we have to specify more and more context just to get results that aren't noise.

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by Brian_K_White on Tuesday September 24, 2024 @11:51AM (#41637877)
2nd result on kagi was about him but in the form of another critic.

https://datatracker.ietf.org/doc/draft-thomson-postel-was-wr...

Hard disagree.

It's a valid argument, but I say it's merely an argument, not an argument that wins or should win.

But also, I say that detecting out of spec or unexpected input and handling it in any other way than crashing IS adhering to Postel.

Refusing to process a request is better than munging the data according to your own creative interpretation of reasonable or likely, and then processing that munged data.

I consider that to be within Postel to return a nice error (or not if that would be a security divulgence). Failing Postel would be to crash or do anything unintended.

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by stackghost on Tuesday September 24, 2024 @12:04PM (#41638027)
I'm actually astounded at how quickly the quality of Google search results has tanked in recent years.
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by AStonesThrow on Tuesday September 24, 2024 @11:25AM (#41637538)
Bing had no trouble at all finding him from my device.
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by runjake on Tuesday September 24, 2024 @11:03AM (#41637299)
Jon Postel was instrumental in making the Internet what it is today.

https://en.wikipedia.org/wiki/Jon_Postel

The Wikipedia article is kinda unclear and doesn't provide the proper context, so:

- Ran IANA, which assigned IP addresses for the Internet.

- Editor of RFCs, which are documents that defined protocols in use by the Internet.

- He wrote a bunch of important RFCs that defined how some very important protocols should work.

- Created or helped create SMTP, DNS, TCP/IP, ARPANET, etc.

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by CoastalCoder on Tuesday September 24, 2024 @10:43AM (#41637018)
Adding to the sibling comments, this is briefly covered in Eric Raymond's wonderful book, "The Art of Unix Programming" [0].

[0] https://en.wikipedia.org/wiki/The_Art_of_Unix_Programming

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by teraflop on Tuesday September 24, 2024 @10:09AM (#41636621)
It's a reference to "Postel's law" which is a pretty well-known principle in the networking world, and in software more broadly. Named after Jon Postel, who edited and published many of the RFCs describing core Internet protocols.

https://en.wikipedia.org/wiki/Robustness_principle