Skip to content

Commit 930282d

Browse files
authored
docs(security): clarify static-graph exemption covers string-literal import() (#3178)
1 parent 84f3ef0 commit 930282d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

runtime/fundamentals/security.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,13 @@ the key principles of Deno's security model:
5353
All modules that are imported in the initial static module graph (local files,
5454
npm packages, jsr packages, and remote URLs) are loaded by the runtime without
5555
consulting the permission system. No `--allow-read` is required to load local
56-
files, and no `--allow-net` is required to fetch remote modules. This
56+
files, and no `--allow-net` is required to fetch remote modules. The static
57+
graph includes static `import` statements and `import()` calls whose specifier
58+
is a string literal — anything that can be resolved without running code. This
5759
exemption applies only to loading. Once code runs, anything it does still goes
58-
through the permission system, and dynamic imports are not covered by the
59-
exemption.
60+
through the permission system, and `import()` calls with non-literal
61+
specifiers (e.g. `import(someVariable)`) are checked against `--allow-read` /
62+
`--allow-import` at runtime.
6063

6164
These key principles are designed to provide an environment where a user can
6265
execute code with minimal risk of harm to the host machine or network. The

0 commit comments

Comments
 (0)