Deno: Default to always printing log message when permissions are accessed

Created on 13 Jun 2019  ·  5Comments  ·  Source: denoland/deno

So users would get by default a list of files accessed even if --allow-read is on.

Use an emoji of some sort to distinguish them from normal output. Maybe something like

⚠️  Read granted "/etc/passwd"

Should log to stderr.

Most helpful comment

Personal opinion, I would rather see something other than ⚠️ for permission access. It is far more informational. It is something that you have said is ok to do, but you want to keep an eye on it. Maybe or 🦕 is better for this class of information.

Also, instead of dealing with --no-prompt, I wonder if it would be better to introduce an internal logging level, and put things like logging of permission access as information. Things like privilege escalation as warnings, etc...

All 5 comments

A script that reads a hundred files from the current directory will log that many lines in stderr? That seems too verbose for a default.

I think a better (breaking) change would be for --allow-read to mean --allow-read=.

@hayd --no-prompt suppresses that

@bartlomieju IIUC this issue is distinct from the prompt.

get by default a list of files accessed even if --allow-read is on

I got simple prototype working:

deno_dev --allow-net --allow-read https://deno.land/std/http/file_server.ts
⚠️  Granted network access to "0.0.0.0:4500"
HTTP server listening on http://0.0.0.0:4500/
⚠️  Granted read "/Users/biwanczuk/dev/deno"
⚠️  Granted read "/Users/biwanczuk/dev/deno"
⚠️  Granted read "/Users/biwanczuk/dev/deno/Cargo.toml"
⚠️  Granted read "/Users/biwanczuk/dev/deno/buildtools"
⚠️  Granted read "/Users/biwanczuk/dev/deno/tools"
⚠️  Granted read "/Users/biwanczuk/dev/deno/Releases.md"
⚠️  Granted read "/Users/biwanczuk/dev/deno/core"
⚠️  Granted read "/Users/biwanczuk/dev/deno/BUILD.gn"
⚠️  Granted read "/Users/biwanczuk/dev/deno/build_extra"
⚠️  Granted read "/Users/biwanczuk/dev/deno/LICENSE"
⚠️  Granted read "/Users/biwanczuk/dev/deno/out"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.gn"
⚠️  Granted read "/Users/biwanczuk/dev/deno/js"
⚠️  Granted read "/Users/biwanczuk/dev/deno/target"
⚠️  Granted read "/Users/biwanczuk/dev/deno/website"
⚠️  Granted read "/Users/biwanczuk/dev/deno/node_modules"
⚠️  Granted read "/Users/biwanczuk/dev/deno/tests"
⚠️  Granted read "/Users/biwanczuk/dev/deno/Cargo.lock"
⚠️  Granted read "/Users/biwanczuk/dev/deno/gh-pages"
⚠️  Granted read "/Users/biwanczuk/dev/deno/deno.gni"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.yarnclean"
⚠️  Granted read "/Users/biwanczuk/dev/deno/prebuilt"
⚠️  Granted read "/Users/biwanczuk/dev/deno/cli"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.appveyor.yml"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.gitmodules"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.prettierignore"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.editorconfig"
⚠️  Granted read "/Users/biwanczuk/dev/deno/README.md"
⚠️  Granted read "/Users/biwanczuk/dev/deno/testing"
⚠️  Granted read "/Users/biwanczuk/dev/deno/rollup.config.js"
⚠️  Granted read "/Users/biwanczuk/dev/deno/third_party"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.prettierrc.json"
⚠️  Granted read "/Users/biwanczuk/dev/deno/build_overrides"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.gitignore"
⚠️  Granted read "/Users/biwanczuk/dev/deno/package.json"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.github"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.gitattributes"
⚠️  Granted read "/Users/biwanczuk/dev/deno/tsconfig.json"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.rustfmt.toml"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.eslintignore"
⚠️  Granted read "/Users/biwanczuk/dev/deno/build"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.git"
⚠️  Granted read "/Users/biwanczuk/dev/deno/gclient_config.py"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.travis.yml"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.eslintrc.json"
⚠️  Granted read "/Users/biwanczuk/dev/deno/.idea"
[2019-06-13 20:31:49] "GET / HTTP/1.1" 200
⚠️  Granted read "/Users/biwanczuk/dev/deno/favicon.ico"
[2019-06-13 20:31:49] "GET /favicon.ico HTTP/1.1" 404

With --no-prompt flag:

deno_dev --allow-net --allow-read --no-prompt https://deno.land/std/http/file_server.ts
HTTP server listening on http://0.0.0.0:4500/
[2019-06-13 20:32:56] "GET / HTTP/1.1" 200

Personal opinion, I would rather see something other than ⚠️ for permission access. It is far more informational. It is something that you have said is ok to do, but you want to keep an eye on it. Maybe or 🦕 is better for this class of information.

Also, instead of dealing with --no-prompt, I wonder if it would be better to introduce an internal logging level, and put things like logging of permission access as information. Things like privilege escalation as warnings, etc...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kyeotic picture kyeotic  ·  3Comments

ry picture ry  ·  3Comments

ry picture ry  ·  3Comments

zugende picture zugende  ·  3Comments

motss picture motss  ·  3Comments