by aleph_minus_one · 1w ago · 0 comments
Putting limits on a scripting language should not be too hard (even without talking about any correctness proof). And I would bet that for a scripting language where the limits are in a way that "in a correct implementation, it should be highly likely that these limits are actually enforced" (i.e. the specification of the scripting language has no parts that makes you suspicious whether there exists some loophole that a malicious actor could use to overstep the limits), it should actually be possible to write a verified implementation with some effort.
But this is not what people want: for example, basically every evolution of the web standards since HTML5 by the WHATWG was about extending what is possible to do in the scripting language (JavaScript).
Among other examples, it specifically mentions that you if lego together two Push-Down Automata chatting with each other you get a Turing Machine back out. It doesn't include my other favorite recent example that we found a 0-day sandbox escape in the Universal Turing Machine itself.
The problems generally keep coming back to the Church-Turing Hypothesis that if you've got one Turing Complete language you've got theoretical access to them all.
Turing Completeness in turn seems an "emergent property" rather than a hard bar to clear. Rule 110 [0] shows Turing Completeness in the mathematical equivalent of a petri dish. We've built Turing Machines out of Magic the Gathering card game decks [1].
To some extent if there was a way to build a truly, well enforced, secure scripting language you would think that we would have already found it given how important it would be to security and to safety.
I'm not sure where the limits we need to place are, but that's the reasonable place to start.
> The restriction made by total languages, therefore, does not help make verification any easier. Indeed, it would have been surprising to discover that an impossible problem becomes easy by restricting it just a bit (giving up leather seats does not reduce the cost of a car by 90%). We also note that every program could be trivially made total by adding a large counter, say 2^100 to all loops – this won’t change its physical semantics in any way – so we can already assume all real-world programs to be written in total languages without loss of generality. If total languages helped, we could have assumed all languages are total.
To rephrase it a little: all of our Turing Machines are limited (by RAM, by power, by transistor count, etc) compared to the Universal Turing Machine (infinite in scope, as a thought exercise), but that doesn't make solving safety or security easier.
If no one function can have 1000 calls, you make a million functions. If no one loop can go more than 1000 ticks, you put that in a function and call that function in a loop. Suddenly you have access to a million iterations through a loop.
The problem with Turing Machines is that even (intentionally) broken ones always tend to have unexpected sandbox escapes.