News for hackers. Stuff that matters.
Re:Execute JavaScript in a WebAssembly QuickJS Sandbox by spankalee on Sunday July 07, 2024 @01:21PM (#40898985)
Salesforce does this with a combination of web components, with a patched up ShadowRoot so that code with a reference to the shadow root can't walk into the rest of the document, and a secure evaluator function related to SES (Secure EcmaScript) to limit the globals the untrusted script has access too.

The secure evaluator is wild. I think this is the heart of it: https://github.com/Agoric/realms-shim/blob/v1.1.0/src/evalua...

There's also an idea for isolated web components to solve this in the platform: https://github.com/WICG/webcomponents/issues/1002

Re:Execute JavaScript in a WebAssembly QuickJS Sandbox by m1el on Sunday July 07, 2024 @03:41PM (#40899922)
Salesforce sandboxing is too easy to escape. Last time I needed to implement some feature for Salesforce, I've encountered 4 different escapes. It was also horrible dev experience.
Re:Execute JavaScript in a WebAssembly QuickJS Sandbox by spankalee on Sunday July 07, 2024 @11:00PM (#40902261)
I would love to hear more about that. I'm looking into their approach for a plug-in system myself.
Re:Execute JavaScript in a WebAssembly QuickJS Sandbox by cxr on Sunday July 07, 2024 @01:47PM (#40899157)
You can also check out the discussion for Figma's earlier work on their plugin system, which is what inspired jitl (above) to create quickjs-emscripten. Previously:

How to build a plugin system on the web and also sleep well at night. <https://news.ycombinator.com/item?id=20770105> 2019 August 22. 89 comments.