News for hackers. Stuff that matters.
Re:Servo Nightly Builds Available by gsnedders on Friday July 01, 2016 @05:47AM (#12014831)
> By now, HTML and the standards surrounding it have become so big that starting from a blank slate nowadays is next to impossible.

It's a two sided coin: HTML now defines a lot of the basic web platform parts in enough detail that you can just implement the spec and have a web browser that works, whereas in the 90s (and most of the 00s) browsers spent huge amounts of resources on reverse-engineering each other. Pretty much the only way to be web compatible then was to start with something already mostly web compatible (consider the fact that Apple's first two or three years of work on WebKit were essentially spent pretty much just fixing web compat bugs!).

Re:Servo Nightly Builds Available by larsberg on Friday July 01, 2016 @08:25AM (#12015427)
> you can just implement the spec and have a web browser that works

Don't forget the amazing work being done at http://testthewebforward.org/ with the Web Platform Tests and your own work on the CSSWG tests! Beyond the specs, having a cross-browser set of tests that have especially good coverage on newer specs has been a huge leg-up for Servo!

It not only helps us ensure interop for those features that are tested, but (puts on former dev manager hat) it really helps quantify how many work items are left until a feature is closer to completion. I especially notice it when there are areas like CSS 2.1 where the tests are less comprehensive and it's harder to quantify what our progress/status is.

Re:Servo Nightly Builds Available by Manishearth on Friday July 01, 2016 @08:46AM (#12015531)
So much this.

These tests are super useful. They don't just test for the spec, they also test for known behavior, which makes it possible to find spec bugs.

Plus they contain a very good framework which we can easily add our own tests into, instead of rewriting an HTTP testing server and whatnot.

Re:Servo Nightly Builds Available by gsnedders on Friday July 01, 2016 @09:03AM (#12015646)
To be fair, having tests somewhat relies on having a spec. OK, so in theory we could've had a cross-browser set of tests with some requirement along the lines of "this web page relies on this behaviour", but ultimately you'd still end up with contradictory tests. :)

I wonder if it's worthwhile to spend some time working on the 2.1 testsuite to try and improve coverage at some point. Probably? Unlikely to find so many bugs in mature implementations, hence why so much effort has been spent elsewhere.

Re:Servo Nightly Builds Available by jgraham on Friday July 01, 2016 @10:46AM (#12016416)
<vested interest hat on>

For too long it was considered OK to have a spec with either no tests, or tests that focused on the wrong thing ("is it possible to implement this spec" vs "do implementations behave in compatible ways"). It is still considered too OK for browser vendors to write their own tests for a feature and not share them with the rest of the community. However, pressure from other platforms is changing attitudes here as it becomes increasingly apparent that without a stronger degree of interoperability, developers will vote with their feet and target platforms with fewer bugs to trip over.

Re:Servo Nightly Builds Available by larsberg on Friday July 01, 2016 @10:51AM (#12016469)
I think it's worthwhile! Lack of a comprehensive test suite means:

1) There are seem to still be regressions in pretty fundamental stuff when new features are added. Usually caught before things reach "release" trains, but I see it in bug trackers all the time.

2) Other layout engine managers I've talked with who want to do a layout system rewrite are terrified of anything that doesn't look like a large-scale refactoring because of this issue. I've had the "how are you testing and measuring progress / how do you know you're done with layout?" conversation with most of our engine peers at this point :-)

Re:Servo Nightly Builds Available by Manishearth on Friday July 01, 2016 @05:59AM (#12014867)
Well, we still do lots of reverse-engineering, because the specs are often wrong :)
Re:Servo Nightly Builds Available by gsnedders on Friday July 01, 2016 @06:21AM (#12014940)
A lot is relative. :)

Honestly, from what I see, the amount you do is relatively minuscule compared with what Opera was doing ten years ago, while Opera had far more marketshare which is normally the best way to avoid web compat issues in the first place.

Re:Servo Nightly Builds Available by nickpsecurity on Friday July 01, 2016 @10:50AM (#12016457)
It's a rule of thumb in most software I found studying high-assurance. Inevitably, some academic or commercial team wants to robustly implement some standard (esp a protocol). They notice it's specified in a combo of English and implementation code. They start doing formal specifications of English spec. Every time, IIRC, they find various inconsistencies and such that already did or could lead to real-world problems. Showed me the value of formal specs but also important lesson: using informal specs will almost always require reverse engineering and extensive testing due to, at very least, English ambiguity or implementation deviations.
Re:Servo Nightly Builds Available by MichaelGG on Friday July 01, 2016 @03:29PM (#12019014)
Implementing SIP a couple of times, part of it is the other implementations just flat-out misread. Even when there's a formal syntax specified, they simply ignore it. For instance, SIP specifies a "lr" (loose route) parameter. The syntax is just that: lr. But many implementations get it wrong and require a value, like lr=1, or lr=true.

Even things as simple as line endings are implemented wrong (in HTTP too), and that can cause security consequences as proxies end up reading headers differently than the user agents. I've seen this live on the public Internet.

SIP and the IETF to some extent encourages this with Postel's Law, telling implementors they should guess what the intention of the message is. We need less of VB's On Error Resume Next and more panic-abort type functionality. Look at this insane document: https://tools.ietf.org/html/rfc4475 "SIP Torture Tests". The authors gleefully come up with ridiculous yet legal permutations of messages that are allowed under their arcane rules. The fact this exists should send the opposite message: simplify your damn protocol. And this is only at the parsing level!

I know people say that HTML could never have had strictness because it'd have been too hard, but I don't buy that. One common issue was getting nesting wrong, like <b><i></b></i> or leaving unclosed tags. By removing the (silly, honestly) name out of the ending tag and just using </>, a whole class of errors is removed. Add in a browser that just fails to render and explains exactly why, and people would quickly not publish pages that are broken.

Re:Servo Nightly Builds Available by gsnedders on Friday July 01, 2016 @03:36PM (#12019071)
> SIP and the IETF to some extent encourages this with Postel's Law, telling implementors they should guess what the intention of the message is. We need less of VB's On Error Resume Next and more panic-abort type functionality.

I don't think it's as clear-cut as that. I think the main thing is error handling must be defined: it doesn't matter whether it's panic-abort or whether it's defined how to deal with any stream of bytes. Don't let implementers choose what they should do.

Re:Servo Nightly Builds Available by MichaelGG on Friday July 01, 2016 @07:10PM (#12020352)
Well the error handling is defined. Return a 400 Bad Request. Except implementors are encouraged to try to avoid that if they can make guesses.
Re:Servo Nightly Builds Available by gsnedders on Friday July 01, 2016 @09:30PM (#12020970)
It isn't everywhere.

RFC 7230, for example, has error handling sometimes as SHOULD return 400 Bad Request and sometimes as MUST return 400 Bad Request. But that only applies to servers and proxies parsing requests, which are really the relatively well-implemented part of HTTP. (The vast majority come from browsers, which are always syntactically valid; responses can come from arbitrary CGI scripts and you get all kinds of syntactic nonsense there.) Sadly, there's comparatively few normative requirements when it comes to parsing responses, even ones which are needed for backwards compatibility (at what point do you conclude you're just talking to an HTTP/0.9 server?).

Re:Servo Nightly Builds Available by Manishearth on Friday July 01, 2016 @12:59PM (#12017801)
So most of the spec bugs I've come across don't have to do with English vagaries; they have to do with the reverse-engineering not being perfect. Converting the nebulous concept of expected behavior into procedural text is hard, and there are bugs.

So yeah, "implementation deviations" is usually the issue, but not really English ambiguity, at least with web specs. I put my pedant hat on when looking at proposed changes to web specs, and I believe the rest of the community does too :)

Re:Servo Nightly Builds Available by gsnedders on Friday July 01, 2016 @03:33PM (#12019040)
There have certainly been spec bugs that could be found from a formal specification, some of which are security related (most of the TLS bugs found by miTLS have been protocol bugs simply found as a result of encoding much of the semantics formally).

That said, while I certainly have a fondness for formal specifications, I also always end up feeling like they have a lot of downsides. They're often very verbose and hard to skim, and they're also another language that anyone implementing the specification has to learn prior to implementing it (or they can just wing it, but then your formal specification is worth nothing!).

Re:Servo Nightly Builds Available by nickpsecurity on Friday July 01, 2016 @05:29PM (#12019810)
Re specs downsides

The wisdom from old days was to use relatively, simple, formal languages that were easy to train people on and use. B, Z, and TLA had good results plus lasted over time. The other thing was to do English spec, formal spec, and code side-by-side with each team looking for inconsistencies. The developers usually picked up the basics of the technique rather quickly but at least one specialist was always necessary to make first use go smoothly.

So, that's still my recommendation. A subset of those, especially focusing on states and contracts, done in same fashion against English specs and clear code should take lower work than going all Isabelle, NuPRL, or PVS on a problem. Second application is also always easier. Reuse where possible helps as with code.

So, some difficulties and training but probably easier than some frameworks, etc IT people learn today.

Re:Servo Nightly Builds Available by gsnedders on Saturday July 02, 2016 @05:43AM (#12021975)
(As a disclaimer, for some context, I have only relatively passing experience with Z, and the majority of formal modelling of specs I've done is using CSP.)

From when I've considered trying to formalise parts of the platform before, some of the things that often get hit very quickly are the fact that most of the web platform is defined in terms of sequences of Unicode code points, and ultimately any formalisation is going to have to deal with that (be it some complex parser—like HTML—or some simple validation of it matching a regular grammar). It has always seemed to me that to get much advantage you need to be able to programmatically assert statements about it (including, most obviously, pre-conditions are satisfied at all call-sites), but once you've gone from 2^256 to 2^1114112 characters you end up with such massive state explosion that even many symbolic tools start to struggle quickly.

Now, maybe I've tried using the wrong tools, or maybe I'm structuring things wrong, but it'd be nice to have some way to do this.

Re:Servo Nightly Builds Available by nickpsecurity on Saturday July 02, 2016 @10:56AM (#12022772)
Hmm. That's unusual situation. I've seen descriptions that sound similar in B data validation. For now, I'll just make a note of this comment to bring up when I next bump into formal methodists that might have answers.
Re:Servo Nightly Builds Available by gsnedders on Saturday July 02, 2016 @05:37PM (#12023875)
Thanks! If you get an answer, please drop me an email ([email protected]), because I'd love to hear it.
Re:Servo Nightly Builds Available by nickpsecurity on Friday July 01, 2016 @02:08PM (#12018362)
Interesting. Thanks for the perspective.