Quick Start
3 commands to a secure npm workflow
# Download files below or configure + download zip
$ ./dnpm setup
$ ./dnpm run dev
$ ./dnpm install axios # sandboxed, safe from supply chain attacks
# React Native / Expo? Sync modules to host:
$ ./dnpm sync # copies sandboxed modules for Metro/XcodeProject Settings
Resource Limits
Required for HMR when using Docker on macOS. Disable on Linux for better performance.
Full Secure Workflow
Install, scan, and develop — every step protected.
./dnpm setupInstall deps in sandbox (scripts blocked, then rebuild offline)
./dnpm checkAudit vulnerabilities, verify signatures, scan for suspicious behavior
./dnpm install <pkg>Add a package (sandboxed, writable lockfile)
./dnpm ciClean install from lockfile (two-phase, deterministic)
./dnpm syncRN/Expo onlyCopy sandboxed modules to host (React Native, Expo, Metro)
./dnpm run devStart dev server inside container
./dnpm run buildProduction build with zero network access
./dnpm auditVerify package signatures against npm registry
./dnpm shellOpen a debug shell inside the container
./dnpm nukeRemove all volumes and rebuild from scratch
12 Security Layers
Every npm operation runs inside a hardened container with these protections active.
Your project source is mounted read-only. Malicious packages cannot modify your code, inject backdoors, or tamper with build scripts.
All Linux capabilities are dropped (CAP_NET_RAW, CAP_SYS_ADMIN, etc.). Packages cannot sniff network traffic, mount filesystems, or escalate privileges.
Custom seccomp profile restricts syscalls to a whitelist. Socket creation is limited to AF_UNIX, AF_INET, AF_INET6, and AF_NETLINK only.
NPM lifecycle scripts (postinstall) are disabled by default. The #1 supply chain attack vector (like the axios RAT) is neutralized.
Build and rebuild commands run with network_mode: none. Even if a script slips through, it cannot phone home or exfiltrate data.
All operations run as the node user (UID 1000). No root access inside the container, preventing privilege escalation.
npm registry is pinned to registry.npmjs.org. Prevents dependency confusion attacks where private package names are hijacked on alternate registries.
/tmp is mounted with noexec flag. Malicious scripts cannot download and execute binaries from temp directories — a common attack pattern.
The no-new-privileges security option prevents setuid/setgid binaries from gaining elevated permissions inside the container.
Memory, CPU, and PID limits prevent fork bombs and resource exhaustion attacks. A malicious package cannot crash your system.
Before every install, dnpm checks package-lock.json for non-npmjs.org URLs that could indicate lockfile poisoning attacks.
Dependencies download with scripts disabled (Phase 1), then postinstall runs with zero network (Phase 2). Separates fetching from execution.
npm vs bun vs dnpm
dnpm provides defense-in-depth that npm and bun cannot match.
| Protection | npm | bun | dnpm |
|---|---|---|---|
| Runs postinstall by default | ! | — | — |
| Read-only project mount | — | — | ✓ |
| Offline builds (no network) | — | — | ✓ |
| Seccomp syscall filtering | — | — | ✓ |
| Non-root container user | — | — | ✓ |
| All capabilities dropped | — | — | ✓ |
| noexec /tmp | — | — | ✓ |
| Lockfile integrity check | — | — | ✓ |
| Registry pinned to npmjs.org | — | — | ✓ |
| Resource limits (memory/CPU/PIDs) | — | — | ✓ |
How to Generate a Secure npm Sandbox
- 1
Enter your project details
Set your project name, select a framework (React, Next.js, Astro, etc.), choose a Node.js version, and configure the dev server port. - 2
Configure resource limits
Set memory limits, CPU quotas, max PIDs, and /tmp size. These prevent runaway scripts from consuming host resources during installs or builds. - 3
Review the security layers
The generator automatically enables 12 security layers including two-phase install, capability dropping, seccomp filtering, non-root execution, and registry pinning. - 4
Download or copy the config files
Get the generated Dockerfile, docker-compose.yml, and dnpm wrapper script. Copy them into your project root and run ./dnpm setup to start. - 5
Run your first sandboxed install
Use ./dnpm install to add packages safely. Phase 1 downloads with scripts disabled, Phase 2 rebuilds with zero network access. Run ./dnpm check for a full security scan.
Common Use Cases
Preventing Supply Chain Attacks
Securing CI/CD Pipelines
Safe Open Source Evaluation
Why Use dnpm?
Frequently Asked Questions
Does dnpm replace npm?
Will my npm scripts still work?
Does it work with yarn or pnpm?
Why not just use bun?
Is there a performance impact?
Related Tools
Loadbalancer Design
Developers
Json Formatter
Developers
Json Minifier
Developers
Json Escaper
Developers
Url Params To Json
Developers
Json To Url Params
Developers
Json Path Finder
Developers
Json To Html Form
Developers
Json To Tailwind Form
Developers
Json To Bootstrap Form
Developers
Json To React Form
Developers
Form To Json Schema
Developers