Re:Reddit's website uses DRM for fingerprinting
by kiwidrew on Wednesday July 08, 2020 @08:22PM
(#23775754)
I wonder, would it be possible to identify a subset of Javascript that is benign? Perhaps some rules about which functions the script is permitted to use, along with restrictions on looping constructs (iterate through an array = OK; unbounded recursion = not OK)...
That way simple stuff like:
var form = document.forms[0];
document.getElementById('foo').addEventListener('change',
function (e) {
if (e.target.value == 'xyzzy')
form.elements['bar'].classList.add('show');
}
);
would be perfectly fine, but crazy "let's exploit the JIT" or "emulate an entire 8-bit home computer" stuff would be rejected.And then, as a bonus, we could dump the entire JIT infrastructure and go back to a simple JS interpreter (a la Duktape) because there just wouldn't be much code left to interpret in the first place.
Re:Reddit's website uses DRM for fingerprinting
by bigiain on Wednesday July 08, 2020 @08:38PM
(#23775839)
> (iterate through an array = OK; unbounded recursion = not OK)...
Right, so all we need to do is solve the halting problem... <smirk>
Re:Reddit's website uses DRM for fingerprinting
by kiwidrew on Thursday July 09, 2020 @01:26AM
(#23777189)
Yeah, so some syntactic rules (using Array.forEach() instead of for(;;) loops) and prohibiting some of Javascript's more dynamic features might be enough to render the language non-Turing complete. It would also -- and this is kind of the point -- render the language unable to perform certain computations that plain vanilla Javascript can perform.
Re:Reddit's website uses DRM for fingerprinting
by userbinator on Wednesday July 08, 2020 @09:34PM
(#23776153)
The halting problem is about the general case, but when deciding a sane subset of JS, one can always be more conservative.
Re:Reddit's website uses DRM for fingerprinting
by saagarjha on Wednesday July 08, 2020 @10:40PM
(#23776456)
Yeah, if your subset of JavaScript is not Turing complete.
Re:Reddit's website uses DRM for fingerprinting
by anonms-coward on Wednesday July 08, 2020 @09:33PM
(#23776148)
If you can prove whether recursion or even a loop is bounded or not, you have solved the collatz conjecture.
Long story short, eventually you're going to want some user interaction beyond submitting forms, and if you've built your site as anything other than a js SPA, it's quickly going to become ugly.