diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2020-05-07 00:21:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-06 18:21:13 -0400 |
commit | 34ec3b225425cecdccf754fbc87f4a8f3728890d (patch) | |
tree | 35db52bf25ccf64425692116197df61a69ea8838 /docs/getting_started/permissions.md | |
parent | 846c049c9b3ab36d0893292a204c4d0a18de4c8e (diff) |
Multi page manual (#5110)
Diffstat (limited to 'docs/getting_started/permissions.md')
-rw-r--r-- | docs/getting_started/permissions.md | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/docs/getting_started/permissions.md b/docs/getting_started/permissions.md new file mode 100644 index 000000000..a3d0a9ea0 --- /dev/null +++ b/docs/getting_started/permissions.md @@ -0,0 +1,37 @@ +## Permissions + +<!-- TODO(lucacasonato): what are permissions --> + +<!-- TODO(lucacasonato): description of all permissions --> + +### Permissions whitelist + +Deno also provides permissions whitelist. + +This is an example to restrict file system access by whitelist. + +```shell +$ deno run --allow-read=/usr https://deno.land/std/examples/cat.ts /etc/passwd +error: Uncaught PermissionDenied: read access to "/etc/passwd", run again with the --allow-read flag +► $deno$/dispatch_json.ts:40:11 + at DenoError ($deno$/errors.ts:20:5) + ... +``` + +You can grant read permission under `/etc` dir + +```shell +$ deno run --allow-read=/etc https://deno.land/std/examples/cat.ts /etc/passwd +``` + +`--allow-write` works same as `--allow-read`. + +This is an example to restrict host. + +```ts +const result = await fetch("https://deno.land/"); +``` + +```shell +$ deno run --allow-net=deno.land https://deno.land/std/examples/curl.ts https://deno.land/ +``` |