3 ms·
o/ Luca! Fellow TC39 delegate here. > It is unlikely that freezing all intrinsic prototypes and objects is even enough. People will find ways to exfiltrate tok
by bakkoting 4y ago
o/ Luca! Fellow TC39 delegate here.
> It is unlikely that freezing all intrinsic prototypes and objects is even enough. People will find ways to exfiltrate tokens.
This is probably true, but frozen intrinsics would make it a _lot_ harder. Right now it's not reasonable to ask a library to be defensive against capability exfiltration, since it means not using any built-ins, but I think with frozen intrinsics it would be reasonable to treat a library leaking its capabilities as a security bug. There would still absolutely be leaks - most significantly in libraries which export classes and don't freeze the class prototype - but things would no longer be completely insecure by default. It would make malicious code have to work a _lot_ harder.
I think it's worth a shot. Deno removed the __proto__ getter/setter, and that did require a bunch of libraries to update, but it worked out OK.
Node already has --frozen-intrinsics, if anyone feels like experimenting with whether that would break your code.
- lucacasonato 4y agoYeah, I agree it is definitely worth trying! I think all the talk around SES will push JS as a whole further towards something that could support capability based permissions securely in the future.