News for hackers. Stuff that matters.
Re:A Secure Runtime for JavaScript and TypeScript Built with... by LunaSea on Sunday July 07, 2019 @02:40AM (#20373858)
As a long time Node.js developer I took a look at the project but it's still a really half-baked implementation of the security flags. You almost always end up flipping all security switches off because your application needs every feature (network, filesystem, etc).

No package signing, no flags per module, no syscall whitelisting, etc.

Re:A Secure Runtime for JavaScript and TypeScript Built with... by kevinkassimo on Sunday July 07, 2019 @04:00AM (#20374047)
You turn all permissions on if you are actually using it as if it is Node for writing servers. But in the case when you are using a (potentially untrusted) code snippet to perform certain operations (like encode/decode base64 values), you do might want a sandbox. (For the case of Node-like usage, we actually also have a basic implementation of whitelisted directories/files for certain permissions, though not perfect atm)

We have also discussed about possibilities of implementing an in-memory file system. (Maybe we will also bring sessionStorage to Deno)

Flags per module is slightly trickier, while whitelisting of certain feature is trivial to implement.

Package signing is indeed a topic that Deno contributors need to discuss further and possibly finding a solution.

Re:A Secure Runtime for JavaScript and TypeScript Built with... by LunaSea on Sunday July 07, 2019 @04:40AM (#20374162)
Sure but logic doesn't exist in a vacuum so in most cases you are going to import / export your input data or your results to the filesystem or through the network.

I actually suggested a more granular, per-module approach to this during the Node Forward and IO.js debacle years ago: https://github.com/node-forward/discussions/issues/14

At the time it was deemed to difficult to implement in Node.js after the fact, which makes sense of course. But I'm disappointed that Deno didn't go for a more bolder, more secure approach. The current system seems pretty pointless.

Re:A Secure Runtime for JavaScript and TypeScript Built with... by kevinkassimo on Sunday July 07, 2019 @09:28AM (#20374978)
It is actually more interesting about the definition of “per module”, because technically every single file is its very own module from the view of V8, and is reinforced in Deno since we are trying to be web compatible, so there is not even a package.json-like construct for you to identify the “root” of any library, more so as there is no more index.js magical resolution
Re:A Secure Runtime for JavaScript and TypeScript Built with... by snek on Sunday July 07, 2019 @11:41AM (#20375633)
I'm really sad that I lost my gist on this, but I was working on a system in Node.js for defining the capabilities of modules in an es module graph (as you suggest) where there might not be defined package boundaries. The implementation complexity (required changes to upstream V8) resulted in us going with node policies as they are today.

I don't remember the exact API, but basically an es module graph is a directed graph (e.g. edges have a direction), and because there is only one entrypoint in node, we can therefore create a hierarchy of modules. From this point on, you basically start at the root with X permissions, and from there each module can reduce the permissions of modules they import (or they can reduce their own permissions, but they can't raise them after that obviously).

Re:A Secure Runtime for JavaScript and TypeScript Built with... by mahmoudimus on Monday July 08, 2019 @02:27PM (#20385358)
This looks interesting. How did you lose the gist? You just can't find it on https://gist.github.com/?
Re:A Secure Runtime for JavaScript and TypeScript Built with... by z3t4 on Sunday July 07, 2019 @03:11PM (#20377116)
Could force all side effects to be called from the main module.
Re:A Secure Runtime for JavaScript and TypeScript Built with... by ZitchDog on Sunday July 07, 2019 @09:54AM (#20375073)
Since modules are loaded from URLs, it would be per TLD.
Re:A Secure Runtime for JavaScript and TypeScript Built with... by kevinkassimo on Sunday July 07, 2019 @10:00AM (#20375101)
Then how about a site like unpkg.com? The definition even becomes much more blurry as redirections and other possible protocols are involved.
Re:A Secure Runtime for JavaScript and TypeScript Built with... by finchisko on Sunday July 07, 2019 @04:49AM (#20374183)
In world of hypervisors, containers, apparmors ..., is sandbox really a significant advantage over nodejs?

Actually I saw yt presentation and it didn't convinced me to switch from nodejs. The differences to nodejs are so little, specially when you're using typescript already. The only significant change is "es modules" with ability to resolve modules from url (plus the sandbox).

Still big kudos to Ryan for nodejs.

Re:A Secure Runtime for JavaScript and TypeScript Built with... by kevinkassimo on Sunday July 07, 2019 @09:20AM (#20374932)
For certain purposes (especially for writing servers), I would actually suggest Go and Rust as much better replacements for Node.js :) (Ryan also mentioned, if you notice, Go as better alternative for fast servers in the original JSConf video)

Ryan and some of us consider the project quite experimental, and the initial focus was not aiming for writing super powerful servers (though it should not be too bad). A pleasant scripting environment with more attention to features that Node have not tried out is more or less the goal.

(Fun fact: Ryan has been into machine learning and data visualization for some time. So Deno was created under the hope to somehow compete with Python in certain aspects)

Re:A Secure Runtime for JavaScript and TypeScript Built with... by fanf2 on Sunday July 07, 2019 @06:19AM (#20374422)
Yes it’s a real shame it isn’t based on object capability security. The resource ID concept makes it really hard to do per-module restrictions, because resources provide global ambient access to anything. And it sounds to me like the dispatch model based on typed arrays means that this is baked in on a fundamental level (unless there are some unforgeable handles that Ryan didn’t mention in his talk).
Re:A Secure Runtime for JavaScript and TypeScript Built with... by qaq on Sunday July 07, 2019 @02:49AM (#20373882)
It's not even 1.0 yet.
Re:A Secure Runtime for JavaScript and TypeScript Built with... by LunaSea on Sunday July 07, 2019 @03:47AM (#20374022)
I'm not talking about the maturity of the project but more about the concept of the feature flag for security.
Re:A Secure Runtime for JavaScript and TypeScript Built with... by inglor on Sunday July 07, 2019 @04:37AM (#20374149)
Node.js had a PR to add that in (with packages enforced but not your 'own' code) and Node has policies to deal with loading untrusted code ( https://nodejs.org/api/policy.html ).

Personally I isolate with OS level containers as I think it's a lot more robust and tested but I definitely see the merit in Deno exploring this - even if it doesn't really work yet it's interesting.

Re:A Secure Runtime for JavaScript and TypeScript Built with... by mnutt on Sunday July 07, 2019 @09:15AM (#20374915)
I thought node.js policies were basically just SubResource Integrity hashes? Are they planning for something more?

I’ve been looking into the isolated-vm module recently and it looks pretty nice. Fly.io built their run-untrusted-code service on top of it.

Re:A Secure Runtime for JavaScript and TypeScript Built with... by tfolbrecht on Sunday July 07, 2019 @05:50AM (#20374361)
I like the idea from a ux perspective. It puts the control in a place where the user runs the code.