diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-09-26 02:50:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-26 01:50:54 +0000 |
commit | 5504acea6751480f1425c88353ad5d36257bdce7 (patch) | |
tree | fa02e6c546eae469aac894bfc71600ab4eccad28 /tests/testdata/workers | |
parent | 05415bb9de475aa8646985a545f30fe93136207e (diff) |
feat: add `--allow-import` flag (#25469)
This replaces `--allow-net` for import permissions and makes the
security sandbox stricter by also checking permissions for statically
analyzable imports.
By default, this has a value of
`--allow-import=deno.land:443,jsr.io:443,esm.sh:443,raw.githubusercontent.com:443,gist.githubusercontent.com:443`,
but that can be overridden by providing a different set of hosts.
Additionally, when no value is provided, import permissions are inferred
from the CLI arguments so the following works because
`fresh.deno.dev:443` will be added to the list of allowed imports:
```ts
deno run -A -r https://fresh.deno.dev
```
---------
Co-authored-by: David Sherret <dsherret@gmail.com>
Diffstat (limited to 'tests/testdata/workers')
4 files changed, 1 insertions, 21 deletions
diff --git a/tests/testdata/workers/permissions_dynamic_remote.ts b/tests/testdata/workers/permissions_dynamic_remote.ts deleted file mode 100644 index 54a361bc0..000000000 --- a/tests/testdata/workers/permissions_dynamic_remote.ts +++ /dev/null @@ -1,11 +0,0 @@ -new Worker( - "http://localhost:4545/workers/dynamic_remote.ts", - { - type: "module", - deno: { - permissions: { - net: false, - }, - }, - }, -); diff --git a/tests/testdata/workers/permissions_dynamic_remote.ts.out b/tests/testdata/workers/permissions_dynamic_remote.ts.out deleted file mode 100644 index 4fb2c2234..000000000 --- a/tests/testdata/workers/permissions_dynamic_remote.ts.out +++ /dev/null @@ -1,6 +0,0 @@ -error: Uncaught (in worker "") (in promise) TypeError: Requires net access to "example.com:443", run again with the --allow-net flag -await import("" + "https://example.com/some/file.ts"); -^ - at async http://localhost:4545/workers/dynamic_remote.ts:2:1 -[WILDCARD]error: Uncaught (in promise) Error: Unhandled error in child worker. - at Worker.#pollControl [WILDCARD] diff --git a/tests/testdata/workers/permissions_remote_remote.ts b/tests/testdata/workers/permissions_remote_remote.ts deleted file mode 100644 index 4df2a8a5d..000000000 --- a/tests/testdata/workers/permissions_remote_remote.ts +++ /dev/null @@ -1,3 +0,0 @@ -new Worker("http://localhost:4545/workers/static_remote.ts", { - type: "module", -}); diff --git a/tests/testdata/workers/static_remote.ts b/tests/testdata/workers/static_remote.ts index 2d6e820fd..6bb64eccd 100644 --- a/tests/testdata/workers/static_remote.ts +++ b/tests/testdata/workers/static_remote.ts @@ -1,2 +1,2 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. +// This file doesn't really exist, but it doesn't matter, a "NotCapable" error should be thrown. import "https://example.com/some/file.ts"; |