---
source: https://iinventedlight.com/library/notes/deno-permissions.md
title: "Deno is secure by default and grants I/O only with permissions"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (denoland/docs and denoland/deno); prose restates cited source lines"
attribution: "Summary by iinventedlight (AI-assisted). Sources: Deno docs, Security and permissions, MIT (denoland/docs); Deno runtime permissions source, MIT (denoland/deno). Copyright (c) 2018-2024 the Deno authors; Copyright 2018-2026 the Deno authors. Notices: Deno documentation (denoland/docs): Copyright (c) 2018-2024 the Deno authors; MIT (https://raw.githubusercontent.com/denoland/docs/main/LICENSE). Deno runtime (denoland/deno): Copyright 2018-2026 the Deno authors; MIT (https://raw.githubusercontent.com/denoland/deno/main/LICENSE.md)."
author: "iinventedlight (synthesis of cited sources); AI-assisted"
date: 2026-11-11
status: published
approved_by: "Cole Withington, 2026-11-11 18:06 PT, Librarian chat widget t46s293: \"Yes, publish all 4 now\""
checked_on: 2026-11-11
as_of: 2026-11-11
confidence: medium
untested: "No code was run; only the fetched source files were read."
category: coding-references
topic_area: "code-systems: Deno"
tags: [deno, permissions, security, sandbox]
client: Librarian
sources:
  - id: S1
    title: "Security and permissions - Deno Docs"
    publisher: Deno (denoland/docs)
    url: https://docs.deno.com/runtime/fundamentals/security/
    accessed: 2026-11-11
    license: "MIT"
  - id: S2
    title: "Deno runtime permissions source"
    publisher: Deno runtime (denoland/deno)
    url: https://github.com/denoland/deno/blob/main/runtime/permissions/lib.rs
    accessed: 2026-11-11
    license: "MIT"
---
# Deno is secure by default and grants I/O only with permissions

## Short answer

Deno is secure by default. Unless you specifically enable it, a program has no access to sensitive APIs [S1]. You grant permissions with `--allow-*` flags, scoped so a program gets exactly the access it needs [S1]. When an operation is refused, Deno throws a `NotCapable` error [S1]. Permission state is stored as a quadri-state value [S2].

```sh
deno run app.ts
deno run --allow-read=./data app.ts
deno run --allow-net=api.example.com --deny-net=internal.example.com app.ts
```

## Key points

- By default Deno is sandboxed. Unless you allow it, code cannot touch the file system, the network, or the environment, and cannot run subprocesses. [S1]
- `--deny-*` flags override their `--allow-*` counterparts. `-A` (`--allow-all`) grants everything and turns the sandbox off entirely. [S1]
- A few permissions grant access to things Deno cannot sandbox. `--allow-run` and `--allow-ffi` are effectively granting full access. [S1]
- A program can inspect and tighten its own permissions through the `Deno.permissions` API, including query, request, and revoke. [S1]
- `PermissionState` is a quadri-state value for storing permission state, with `Granted`, `Prompt`, and `Denied` cases. [S2]

## Pitfalls

- Granting `--allow-run=deno` is especially dangerous. The script can start another deno process already given `--allow-all`. [S1]
- Be careful when combining `--allow-write` with `--allow-run`. Write access can let a program overwrite an allowed executable. [S1]
- Untrusted code needs more than one layer of defense, including limited permissions. [S1]
- If anything goes wrong during brokering, Deno immediately terminates the process. [S1]

## Claims

- id: C1
  claim: Deno denies sensitive access by default unless the user enables it.
  source: S1
  evidence: "Deno is secure by default."
- id: C2
  claim: Permissions can be limited so a program receives only the access it needs.
  source: S1
  evidence: "a program gets exactly the access it needs"
- id: C3
  claim: A refused permission operation throws a NotCapable error.
  source: S1
  evidence: "Deno throws a `NotCapable` error."
- id: C4
  claim: Some permissions grant access that the sandbox cannot contain.
  source: S1
  evidence: "A few permissions grant access to things Deno cannot sandbox"
- id: C5
  claim: Each permission category carries a stored state value.
  source: S2
  evidence: "Quadri-state value for storing permission state"
- id: C6
  claim: The runtime error message tells users to rerun with the allow flag.
  source: S2
  evidence: "run again with the --allow-{name} flag"

## Sources

- [S1] Security and permissions - Deno Docs. https://docs.deno.com/runtime/fundamentals/security/ . License: MIT. Accessed 2026-11-11.
- [S2] Deno runtime permissions source. https://github.com/denoland/deno/blob/main/runtime/permissions/lib.rs . License: MIT. Accessed 2026-11-11.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: Deno documentation (denoland/docs): Copyright (c) 2018-2024 the Deno authors; MIT (https://raw.githubusercontent.com/denoland/docs/main/LICENSE). Deno runtime (denoland/deno): Copyright 2018-2026 the Deno authors; MIT (https://raw.githubusercontent.com/denoland/deno/main/LICENSE.md). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
