Security & Permissions

Unless specifically enabled, a Deno script has no access to sensitive APIs like file system access, network connectivity, or environment access.

To do so, it is necessary to grant access to these resources with command line flags or with a runtime permission prompt.

triangle-exclamation

Key Principles

No access to I/O by default.

Code executing in a Deno runtime has no access to read or write arbitrary files on the file system, to make network requests or open network listeners, to access environment variables, or to spawn subprocesses.

No limits on the execution of code at the same privilege level.

Multiple invocations of the same application can share data.

Deno provides a mechanism for multiple invocations of the same application to share data, through built in caching and KV storage APIs. Different applications can not see each other's data.

All code executing on the same thread shares the same privilege level.

Code can not escalate its privileges without user consent.

The initial static module graph can import local files without restrictions.

Permissions

By default, access to most system I/O is denied. There are some I/O operations that are allowed in a limited capacity, even by default.

To enable these operations, the user must explicitly grant permission to the Deno runtime. This is done by passing flags to the deno command:

Also, during script execution, a user can grant permissions when prompted by the runtime. (Prompts are not shown if stdout/stderr are not a TTY)

Last updated