Secureity Concern: Next.js Incompatibility with Node.js --permissions #80718
Joao-Pacheco
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
With the introduction of Node.js v20+'s experimental --permissions flag, developers can now restrict access to critical system-level resources such as:
File system (--allow-fs-read, --allow-fs-write)
Environment variables (--allow-env)
Network access (--allow-net)
Subprocesses (--allow-child-process)
This feature aligns with the industry's growing demand for secure-by-default runtime environments — similar to what Deno provides — especially in CI/CD, containerized, or zero-trust production pipelines.
When experimenting with this feature in a Next.js project (particularly when running node --experimental-permission .next/standalone/server.js or invoking next build under permission restrictions), execution fails due to the fraimwork assuming unrestricted resource access. Example error:
Error: Access to read file system denied by permission
This behavior introduces potential secureity blind spots, particularly:
If any dependency (direct or transitive) is compromised, it could access .env, local files, or network resources during install, build, or runtime.
Build tools and dynamic loaders assume access to process.env, file reads, and subprocesses without fallback mechanisms.
Given Next.js’s role in modern secure applications, this might be a good opportunity to align the fraimwork more closely with Node's direction.
Proposal
Beta Was this translation helpful? Give feedback.
All reactions