-
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
Ergonomics: Prompt for permission. #1008
Comments
The repl branch exposes a readline(prompt) method in ts. However a permission prompt must be in rust only, and all it's doing is reading a single char from stdin rust. (So I don't think it would reuse any code.) Would this be per use rather than mutate flags? I think we ought to do away with the:
pattern. Perhaps by not having.allow_net etc. be pub, instead require a method with an appropriate prompt (if temporary additional permission is required):
Or perhaps it could be a Result rather than a bool? |
The definitely needs to be done in purely Rust, as it's privileged. Maybe something like this
Where the signature would be
|
I tried some towards this and ran into two issues:
(Sadly the |
that's fine
Yes - if
|
But I wanted to use |
How to determine whether it's 'Program' vs 'http://gist.github.com/asdfasd.js' in ops? |
I don’t understand the question. Can you elaborate? |
I think the question is "how to know if it is the permission of the running program, or an externally loaded module"? I think the question is not germane to this topic, as the requirement I believe is:
|
In the roadmap (@ry's top comment):
Either it's 'Program' or the external url (or even I think internal file reference would be useful). Edit: aside from this part it's working. |
@hayd this doesn't really matter, because it should request for all permissions needed to run the entire compilation (including any imported scripts). One other thought that came to mind on the topic of requesting for permission is whether it should remember your choice for a given version/compilation. If someone were to build a cli with deno, it would be annoying to have to explicitly give it permission every time you used it |
I think you want to do permission based on a dot/config toml file, either explicitly or by location convention. (Though perhaps there's security concerns if it's a deno writeable file...) Previously I'd imagined there ought to be a permission tree ("which modules can do what"), but that's probably far too complicated and infeasible. The extension is e.g. for net to add any/domain/url as prompt/cli options. |
When I run a program that requires elevated permissions, without any flags, I should be prompted on the command-line to elevate privlages.
This was described in the roadmap:
The "s" option is meant to display a stack trace - so the user can get more information. This doesn't need to be done in the first version.
(cc @hayd - this might be up your alley since you're working on REPL input.)
Let's discuss a strategy before implementation.
The text was updated successfully, but these errors were encountered: