---
title: "How Deno protects against npm exploits"
description: "Recent npm compromises (@ctrl/tinycolor via a malicious postinstall script, and debug/chalk via phishing) exploited Node and npm's default of giving every dependency full access to the filesystem, network and environment."
url: "https://swe.quest/articles/how-deno-protects-against-npm-exploits-3b33c01d28422c1d"
canonical: "https://deno.com/blog/deno-protects-npm-exploits"
source: "Deno"
published: "2025-09-30"
difficulty: "medium"
kind: "How-to"
reading_minutes: 5
tags: ["supply-chain-security","sandboxing","javascript","runtimes"]
---

# How Deno protects against npm exploits

A post on [Deno](https://swe.quest/sources/deno.md), published 2025-09-30, 5 min read, How-to. Original: [https://deno.com/blog/deno-protects-npm-exploits](https://deno.com/blog/deno-protects-npm-exploits)

## Summary

Recent npm compromises (@ctrl/tinycolor via a malicious postinstall script, and debug/chalk via phishing) exploited Node and npm's default of giving every dependency full access to the filesystem, network and environment. Deno runs Node apps in a sandbox with no OS access by default. Access is granted through flags such as --allow-read, --allow-net and --allow-env, which can be scoped to specific paths or hosts or grouped into permission sets in deno.json. Deno also skips postinstall scripts unless allowed per package with --allow-scripts, and can log permission use via DENO\_AUDIT\_PERMISSIONS and DENO\_TRACE\_PERMISSIONS. Its standard library and the JSR registry, which offers publish authorization and automatic provenance statements, further reduce dependency sprawl and supply-chain risk.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Supply chain security](https://swe.quest/tags/supply-chain-security.md) (Security)
- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)
- [Runtimes & VMs](https://swe.quest/tags/runtimes.md) (Compilers & runtimes)

## Prerequisites

- npm package management ([easy posts on Engineering management](https://swe.quest/tags/engineering-management.md?difficulty=easy))
- Node.js basics ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))

## Keywords

Deno, npm, JSR, Node.js, postinstall scripts, tinycolor

## Related posts

- [Deno 2.6: dx is the new npx](https://swe.quest/articles/deno-2-6-dx-is-the-new-npx-58f73c73a151bd8c.md): Deno · 2025-12-10 · Medium · 16 min read · JavaScript, TypeScript, Runtimes & VMs, Supply chain security, Developer tools
  Deno 2.6 adds \`dx\`, an npx equivalent for running npm and JSR package binaries that defaults to full permissions, prompts before download and runs lifecycle scripts.
- [Introducing your new JavaScript package manager: Deno](https://swe.quest/articles/introducing-your-new-javascript-package-manager-deno-23f4f8f8933d6ca1.md): Deno · 2024-11-08 · Medium · 4 min read · JavaScript, Build systems, Developer tools, Supply chain security
  Deno 2 adds \`deno add\`, \`deno remove\`/\`uninstall\`, and \`deno install\` subcommands that manage npm and JSR dependencies in either \`deno.json\` import maps or an existing \`package.json\`, so they work inside Node projects too.
- [Deno 1.28: Featuring 1.3 Million New Modules](https://swe.quest/articles/deno-1-28-featuring-1-3-million-new-modules-2730b24ac8878c7c.md): Deno · 2022-11-14 · Medium · 6 min read · JavaScript, Supply chain security, Runtimes & VMs
  Deno 1.28 stabilizes npm compatibility, letting programs import any of npm's 1.3 million packages via \`npm:\` specifiers in imports or import maps, and run npm CLIs with \`deno run npm:\<pkg\>\`, with no package.json, install step or node\_modules folder by default.
- [Announcing Deno 2](https://swe.quest/articles/announcing-deno-2-5e607a5c7027789d.md): Deno · 2024-10-09 · Easy · 12 min read · JavaScript, TypeScript, Runtimes & VMs, Developer tools, Build systems
  Deno 2 adds backwards compatibility with Node.js and npm, so it runs existing Node projects using package.json, node\_modules and npm workspaces, and supports npm: import specifiers without a manifest.
- [Deno 1.36: More flexible security and expanded testing APIs](https://swe.quest/articles/deno-1-36-more-flexible-security-and-expanded-testing-apis-20f800d81e5efd71.md): Deno · 2023-08-03 · Medium · 8 min read · JavaScript, Runtimes & VMs, Testing, Sandboxing & isolation
  Deno 1.36 adds --deny-\* flags that complement --allow-\* permissions, letting programs open broad access while excluding specific domains, IPs or file paths, with deny taking precedence over allow.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
