upvote
Something can be worse than nothing when it tricks users into thinking it provides meanigful security guarentees.
reply
More than users, too. SMS 2FA for instance will encourage important services like banks and government applications to omit or bypass higher security measures because the visitor is extra verified. When in reality, this is just a boon to attackers, because it's easy to just steal someone's phone number to pass the verification, and then the website's made it even easier by not giving you any additional obstacles. No abuse protection or whatever, because clearly you're the user.

A service I use recently introduced mandatory two-step verification. This is good. However, they implemented this by adding the email factor to all accounts. I had much more secure methods configured, but now you can bypass them with email. This is bad. I'm still not sure they understand what a critical security issue this is.

reply
Node actually took that from Deno, they do have a permission model now: https://nodejs.org/api/permissions.html
reply
From their documentation:

> It does not provide security guarantees in the presence of malicious code. Malicious code can bypass the permission model and execute arbitrary code without the restrictions imposed by the permission model.

The permission model is more of a "help developers not accidentally "rm -rf /" their local machine than it is something that helps end users.

reply
But doesn’t preventing accidents help end users too?
reply
Sure, but it's more footgun protection, and less security. Still useful, but not the same.
reply
You're better off relying on OS-level security mechanisms. Not only is it more likely to be much safer/secure, but it also means you don't have to worry about compatibility, missing features, etc. when you switch runtimes/software stacks.
reply
So, what happens to yt-dlp?
reply
If you like having something for security — even in Node — check out something I invented, called SafeScript.

It’s for executing untrusted code written by others… a large subset of Javascript which guarantees the code can only call the Facades you inject, and you can hook and intercept anything. It works with callbacks and promises.

What’s more is that it runs in WebWorker sandboxes on the web, and uses a proxy to transparently make existing code make same method calls, or use existing objects, like window.document, but to safer versions, which only allow eg createElement.

And because SafeScript automatically awaits every async function, your synchronous calls to HTMLElement methods etc. will be proxied asynchronously and “just work” without changing the original JS code. SafeScript is robust enough that most existing JS components will simply work without changes when ported to SafeScript.

PS: It can also be embedded in PHP, so you can run untrusted handlers there, too, without worrying about PHP’s large security surface.

PPS: SafeScript is deterministic by default, so you can also get the same results across all environments or runs. You can set the random number generator seed yourself, or inject Date.now() as one of your APIs if you want.

Here it is. Should I do a Show HN?

https://github.com/SafeScript/Safescript

reply
If you want people to notice it then yes, you should do a show.
reply