-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deno eval #2081
Comments
I'll take a stab at it 🚀 |
@ry I've just watched your latest talk where you say that you'd like Deno to be your new Perl and I realized that it was basically the reason why I wrote my comments to #1038 and #929, and since one of my use cases for Perl is unix-style line processing, I recently put some thought into how the set of command-line switches of my dreams would look like, especially after my recent discussion with @bartlomieju about permission system and how it could be made more granular. If it is not compatible with your current vision then I think I'll create some wrapper with those characteristics to use in shell scripts and command-line filters but I'd like to share my thoughts and hear if it is at all compatible with the plans for Deno command line usage. (First of all it's interesting to see more of a git-style command-line commands like All single-letter upper-case switches are shortcuts for permissions:
They can be combined as:
i.e. it's a read access to specific file or a sub-tree if it's a directory. The
All single-letter switches not related to permissions are lowercase, from which I think most important for use in command-line unix-style filters would be:
plus some switches for input/output separators and line ending processing. (*) "every line of input" would ideally mean either stdin if there are no arguments, or reading all files if they are specified as command line arguments, like Your recent idea with |
To extend @rsp's example of CLI args: we talked about "permission maps" which essentially could be a JSON file similar in structure to import-map. It would allow to granularly specify what is allowed for package and its imports.
// perms.json
{
"https://deno.land/": {
// standard modules have full permissions
"read": true,
"write": true,
"net": true,
"run": true,
"env": true
},
"https://deno.land/x/postgres": {
// allow `dial` but only for these adresses
"net": [
"0.0.0.0",
"127.0.0.1",
"192.168.1.1/24"
],
"env": true
},
"<some_other_package>": {
"write": [
"/var/www"
],
"read": [
"/var/www",
"/var/server"
]
},
// catch-all for unknown packages, deny all
"*": {
"read": false,
"write": false,
"net": false,
"run": false,
"env": false
}
} This solution requires that permissions are "contextful" - during |
@rsp You bring up a couple of different ideas - I will try to address them individually
@bartlomieju While that seems very useful, I don't want to unilaterally introduce new file formats. (That's how we got package.json.) Maybe there is something in the web package standards that is applicable. In any case, I think this is something we can punt on for a few months. |
The other issue with the json is does write access (to that file) imply permissions could be increased on subsequent executions. So would you need to write protect it somehow (I guess you could have a blacklist of write access as well as a whitelist). Is there a standard within CSP? Kevin had a good solution for 1. having run as (the default) subcommand, that way you can use |
This would allow Deno programs run other Deno programs without ruining the permission system by having them run with general
|
@hayd when I was talking with @bartlomieju about the permissions map, what I had in mind (maybe I didn't express it explicitly) was not something that grants privileges, but rather something that restricts them, and the fact of it being in a JSON file or not would be something irrelevant. Maybe I'll use an example: A file
(the Now, the I think few different things should be separated here:
(1) is what I discussed in my two comments above in this issue and in other comments linked there, (2) is what I would imagine would be the purpose of an object/JSON as written by Bartek, and (3) would be something that I think needs some attention too. We currently have Ideally it would be compatible with mechanisms like OpenBSD's I think that having such a strong focus on security as Deno has, it would be useful to work nicely with operating systems that share that sentiment. When I wrote issue #378 on capability-based security model I was thinking more in the style of GNOSIS, KeyKOS, EROS, CapROS and Coyotos but maybe we should focus more OpenBSD that is often used for applications where security is important and that has some interesting mechanisms with which it would be nice to be compatible. I'm sure that Deno will run on OpenBSD in the future and it would be interesting to have the first scripting language runtime to support native security features of OpenBSD. |
Add new subcommand for evaluating on the command line
Would be cool to have some examples of using Deno.stdin along with this feature in the manual.md to do unix-style line processing. Here's an imaginary command which prints all of the users on the system (note that Deno.lines is not implemented)
The text was updated successfully, but these errors were encountered: