Is Next.js safe?
- Node.js shell/command execution
- Node.js dynamic code execution
- Node.js filesystem read
What to do: Nothing here argues against installing it. Grant the capabilities it lists only if you expect the tool to need them.
Next.js is an npm package analyzed by SkillTotal's deterministic static scanner. The scan found no malicious indicators. It can: dynamic code execution, filesystem read, filesystem write, mcp tools detected, network egress and shell execution — capabilities are what the code can do, not a verdict on intent. Risk score 0/100 (low).
next 16.4.6
Get notified when this component changes
Change alerts aren't live yet. Leave your email and we'll let you know when they launch. We use it only for this and delete it on request.
Automated static-analysis result. It can contain false positives and false negatives, and is not a claim about the intent of Next.js's authors. Report a false positive.
Behavioral traits
How this component maps to the CSA agentic threat model. Descriptive — it never affects the risk score.
Findings (6)
The code turns strings into live code at runtime (eval / new Function / exec).
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
return result(new RawSource(`eval(${compilation.outputOptions.trustedTypes ? `${_webpack.RuntimeGlobals.createScript}(${JSON.stringify(content + footer)})` : JSON.stringify(content + footer)});`));eval(getModuleCode)(
(()=>{"use strict";var __webpack_modules__={994:(e,r)=>{Object.defineProperty(r,"__esModule",{value:true});r.PARENT_MESSAGE_SETUP_ERROR=r.PARENT_MESSAGE_OK=r.PARENT_MESSAGE_CUSTOM=r.PARENT_MESSAGE_CLIENT_ERROR=r.CHILD_MESSAGE_INITIALIZE=r.C …(()=>{"use strict";var __webpack_modules__={994:(e,r)=>{Object.defineProperty(r,"__esModule",{value:true});r.PARENT_MESSAGE_SETUP_ERROR=r.PARENT_MESSAGE_OK=r.PARENT_MESSAGE_CUSTOM=r.PARENT_MESSAGE_CLIENT_ERROR=r.CHILD_MESSAGE_INITIALIZE=r.C …(()=>{var __webpack_modules__={803:e=>{"use strict";class LoadingLoaderError extends Error{constructor(e){super(e);this.name="LoaderRunnerError";Error.captureStackTrace(this,this.constructor)}}e.exports=LoadingLoaderError},349:(module,__unu …"eval() is not supported in this environment. If this page was served with a `Content-Security-Policy` header, make sure that `unsafe-eval` is included. React requires eval() in development mode for various debugging features like reconstru …
"eval() is not supported in this environment. React requires eval() in development mode for various debugging features like reconstructing callstacks from a different environment.\nReact will never use eval() in production mode"
"eval() is not supported in this environment. This can happen if you started the Node.js process with --disallow-code-generation-from-strings, or if `eval` was patched by other means. React requires eval() in development mode for various de …
"eval() is not supported in this environment. If this page was served with a `Content-Security-Policy` header, make sure that `unsafe-eval` is included. React requires eval() in development mode for various debugging features like reconstru …
"eval() is not supported in this environment. React requires eval() in development mode for various debugging features like reconstructing callstacks from a different environment.\nReact will never use eval() in production mode"
"eval() is not supported in this environment. This can happen if you started the Node.js process with --disallow-code-generation-from-strings, or if `eval` was patched by other means. React requires eval() in development mode for various de …
"eval() is not supported in this environment. If this page was served with a `Content-Security-Policy` header, make sure that `unsafe-eval` is included. React requires eval() in development mode for various debugging features like reconstru …
"eval() is not supported in this environment. React requires eval() in development mode for various debugging features like reconstructing callstacks from a different environment.\nReact will never use eval() in production mode"
"eval() is not supported in this environment. This can happen if you started the Node.js process with --disallow-code-generation-from-strings, or if `eval` was patched by other means. React requires eval() in development mode for various de …
"eval() is not supported in this environment. If this page was served with a `Content-Security-Policy` header, make sure that `unsafe-eval` is included. React requires eval() in development mode for various debugging features like reconstru …
"eval() is not supported in this environment. React requires eval() in development mode for various debugging features like reconstructing callstacks from a different environment.\nReact will never use eval() in production mode"
"eval() is not supported in this environment. This can happen if you started the Node.js process with --disallow-code-generation-from-strings, or if `eval` was patched by other means. React requires eval() in development mode for various de …
(function(){"use strict";var __webpack_modules__={600:function(e,t,s){const n=s(742);e.exports=n.default},742:function(e,t,s){Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;var n=_interopRequireDefault(s(16));var o=_ …(function(){var e={166:function(){(function(e,t){"use strict";if(e.setImmediate){return}var n=1;var a={};var s=false;var i=e.document;var r;function setImmediate(e){if(typeof e!=="function"){e=new Function(""+e)}var t=new Array(arguments.le …(function(){var __webpack_modules__={285:function(__unused_webpack_module,exports){var indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);else for(var r=0;r<e.length;r++){if(e[r]===t)return r}return-1};var Object_keys=function(e){if(Obj …* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
return result(new RawSource(`eval(${compilation.outputOptions.trustedTypes ? `${RuntimeGlobals.createScript}(${JSON.stringify(content + footer)})` : JSON.stringify(content + footer)});`));(0, _vm.runInNewContext)(content, contextObject);
Why it matters: If those strings aren't fixed and trusted, they become a way to run arbitrary code.
Fix: Avoid evaluating dynamically constructed code; if unavoidable, ensure the input is a trusted constant and never derived from external data.
The component can run operating-system commands or spawn processes.
const _child_process = require("child_process");const _child_process = require("child_process");const _child_process = /*#__PURE__*/ _interop_require_default(require("child_process"));return _child_process.default.execSync(`${binaryName} --version`, {const proc = spawn(tool.bin, [
const _child_process = require("child_process");const upgradeProcess = (0, _child_process.spawn)(upgradeProcessCommand, upgradeProcessCommandArgs, {(()=>{var e={139:(e,t,n)=>{"use strict";const r=n(317);const s=n(812);const o=n(914);function spawn(e,t,n){const c=s(e,t,n);const i=r.spawn(c.command,c.args,c.options);o.hookChildProcess(i,c);return i}function spawnSync(e,t,n){const c=s(e,t …import { execSync } from 'child_process';execSync('yarn dlx --help', {import { execSync } from 'child_process';const httpsProxy = execSync('npm config get https-proxy', {import { execSync } from 'child_process';execSync('yarn --version', {execSync('pnpm --version', {import { execSync } from 'child_process';const output = execSync(`${pkgManager} config get registry ${resolvedFlags}`, {import { spawnSync } from 'node:child_process';const result = spawnSync('git', args, {import { execSync } from 'node:child_process';const caLocation = execSync(`"${binaryPath}" -CAROOT`).toString().trim();execSync(`"${binaryPath}" -install -key-file "${keyPath}" -cert-file "${certPath}" ${hosts.join(' ')}`, {const caLocation = execSync(`"${binaryPath}" -CAROOT`).toString().trim();import { spawnSync } from 'node:child_process';const child = spawn(process.execPath, [
Why it matters: Powerful and often legitimate — confirm the commands aren't built from untrusted input.
Fix: Confirm the command and its arguments are fully controlled and not derived from untrusted input; prefer execFile with an argument array.
The component reads files from disk.
const clientHashes = bundler === _bundler.Bundler.Turbopack && config.supportsImmutableAssets ? JSON.parse(await _promises.default.readFile(_path.default.join(distDir, 'immutable-static-hashes.json'), 'utf8')) : undefined;
const meta = isAppPage ? JSON.parse(await _promises.default.readFile(getPrerenderFilePath(route, true, '.meta'), 'utf8').catch(()=>'{}')) : {};const nft = JSON.parse(await _promises.default.readFile(traceFilePath, 'utf8'));
hash.update(await _promises.default.readFile(filePath));
return (0, _fs.readFileSync)(filePath, {const data = (0, _nodefs.readFileSync)(file);
return routeSummariesSchema.parse(JSON.parse((0, _nodefs.readFileSync)(summariesFile, 'utf8'))).map(({ route })=>route);const metadata = snapshotMetadataSchema.parse(JSON.parse((0, _nodefs.readFileSync)(_nodepath.join(historyDir, entry, METADATA_FILENAME), 'utf8')));
const babelConfigRaw = (0, _nodefs.readFileSync)(configFilePath, 'utf8');
return await _promises.default.readFile(p, 'utf8');
const existingTrace = JSON.parse(await _promises.default.readFile(traceOutputPath, 'utf8'));
const traceContent = JSON.parse(await _promises.default.readFile(traceFile, 'utf8'));
return _fs.promises.readFile(filePath, 'utf8');
return await _fs.promises.readFile(_path.default.join(distDir, _constants1.BUILD_ID_FILE), 'utf8');
const middlewareNft = JSON.parse(await _fs.promises.readFile(_path.default.join(distDir, _constants1.SERVER_DIRECTORY, 'middleware.js.nft.json'), 'utf8'));
let content = await _promises.default.readFile(templatePath);
const contents = (0, _fs.readFileSync)(filePath, 'utf8');
return _fs.default.readFileSync(lockfilePath, 'utf-8');
const content = (0, _nodefs.readFileSync)(oldFilename, 'utf8');
const nextConfigString = (0, _nodefs.readFileSync)(nextConfigPath, 'utf8');
const config = JSON.parse(await _fs.default.promises.readFile(configPath, 'utf8'));
appPathsManifest = JSON.parse(await _fs.promises.readFile(manifestPath, 'utf8'));
const packageJsonContent = await _fs.promises.readFile(/* turbopackIgnore: true */ packageJsonPath, 'utf8');
const traceData = JSON.parse(await _fs.promises.readFile(/* turbopackIgnore: true */ traceFilePath, 'utf8'));
const EXTERNAL_PACKAGES = _json5.default.parse(_fs.default.readFileSync(_path.default.join(__dirname, '../lib/server-external-packages.jsonc'), 'utf8'));
Why it matters: Usually legitimate, but worth confirming it can't be steered into reading sensitive files.
Fix: Confirm which files are read and that paths cannot be influenced by untrusted input to reach sensitive locations.
The component writes or deletes files on disk.
await _promises.default.writeFile(rscFallbackPath, '{}');_fs.default.rmSync(stagingRoot, {(0, _nodefs.rmSync)(_nodepath.join(distDir, 'diagnostics/analyze/data'), {(0, _nodefs.rmSync)(snapshotDir, {(0, _nodefs.writeFileSync)(_nodepath.join(dataDir, METADATA_FILENAME), JSON.stringify(metadata, null, 2));
(0, _nodefs.rmSync)(snapshotDir, {(0, _nodefs.rmSync)(_nodepath.join(historyDir, snapshotDirectory(snapshot.name)), {(0, _nodefs.writeFileSync)(_nodepath.join(historyDir, HISTORY_INDEX_FILENAME), JSON.stringify({await _promises.default.writeFile(traceOutputPath, JSON.stringify({_promises.default.writeFile(nextServerTraceOutput, JSON.stringify({_promises.default.writeFile(nextMinimalTraceOutput, JSON.stringify({await _promises.default.writeFile(traceFile, JSON.stringify({await _fs.promises.writeFile(filePath, content, 'utf-8');
await _fs.promises.unlink(serverBundle);
].map((extension)=>_fs.promises.rm(_path.default.join(distDir, _constants1.SERVER_DIRECTORY, `${filename}${extension}`), {await _fs.promises.unlink(_path.default.join(distDir, _constants1.EXPORT_DETAIL)).catch((err)=>{await _fs.promises.writeFile(_path.default.join(distDir, _constants1.SERVER_DIRECTORY, 'middleware.js.nft.json'), JSON.stringify(middlewareNft));
await _fs.default.promises.writeFile(configPath, JSON.stringify({await _fs.promises.writeFile(_path.default.join(diagnosticsDir, ROUTE_BUNDLE_STATS_FILE), JSON.stringify(rows, null, 2));
await _fs.promises.writeFile(_path.default.join(distDir, 'turbopack'), '');
await _fs.promises.writeFile(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');await _promises.default.writeFile(configTraceFile, JSON.stringify({await _fs.promises.rm(outputPath, {await _fs.promises.writeFile(packageJsonOutputPath, packageJsonContent);
await _fs.promises.writeFile(serverOutputPath, `${moduleType ? `performance.mark('next-start');Why it matters: Usually legitimate, but worth confirming the paths can't be controlled by untrusted input.
Fix: Confirm which files are written/deleted and that paths cannot be influenced by untrusted input.
The component makes outbound network requests.
const _nodehttp = /*#__PURE__*/ _interop_require_default(require("node:http"));import type { IncomingMessage, ServerResponse } from 'node:http';import type { IncomingMessage, ServerResponse } from 'node:http';import type { IncomingMessage, ServerResponse } from 'node:http';import type { OutgoingHttpHeaders } from 'http';res = await fetch(`http://127.0.0.1:${port}/mcp`, {const _nodehttp = /*#__PURE__*/ _interop_require_default(require("node:http"));const tokenRes = await fetch(uploadUrl, {const res = await fetch(`${registry}-/package/next/dist-tags`);const response = await fetch(endpoint).catch((error)=>{const response = await fetch('https://registry.npmjs.org/next/canary', {return fetch(input, init);
return fetch(input, init);
fetch(`${assetPrefix}/_next/static/development/_devPagesManifest.json`).then((res)=>res.json()).then((manifest)=>{this.promisedDevPagesManifest ||= fetch(`${this.assetPrefix}/_next/static/development/${_constants.DEV_CLIENT_PAGES_MANIFEST}`, {this.promisedMiddlewareMatchers = fetch(`${this.assetPrefix}/_next/static/${this.buildId}/${_constants.DEV_CLIENT_MIDDLEWARE_MANIFEST}`, {styleSheets.set(href, prom = fetch(href, {var { IncomingMessage } = require("http");var http = require("http");var { STATUS_CODES } = require("http");var { STATUS_CODES } = require("http");async function fetch(resource, options) {const res = await import_undici.default.fetch(resource, addDuplexToInit(options));
var { IncomingMessage } = require("http");var http = require("http");Why it matters: Usually legitimate, but confirm the destinations are expected and no sensitive data leaves.
Fix: Confirm the destination hosts are expected and that no sensitive data is sent off-host.
An MCP tool surface (manifest or tool definitions) was found.
const mcpServer = new McpServer({mcpServer.registerTool('query_spans', {const transport = new StreamableHTTPServerTransport({{"version":3,"sources":["../../../src/cli/internal/turbo-trace-server.ts"],"sourcesContent":["import http from 'node:http'\nimport z from 'next/dist/compiled/zod'\nimport { loadBindings } from '../../build/swc'\nimport type { TraceSpanInfo …{"version":3,"sources":["../../../src/cli/internal/turbo-trace-server.ts"],"sourcesContent":["import http from 'node:http'\nimport z from 'next/dist/compiled/zod'\nimport { loadBindings } from '../../build/swc'\nimport type { TraceSpanInfo …{"version":3,"sources":["../../../src/cli/internal/turbo-trace-server.ts"],"sourcesContent":["import http from 'node:http'\nimport z from 'next/dist/compiled/zod'\nimport { loadBindings } from '../../build/swc'\nimport type { TraceSpanInfo …const transport = new StreamableHTTPServerTransport({{"version":3,"sources":["../../../../src/server/mcp/get-mcp-middleware.ts"],"sourcesContent":["import type { ServerResponse, IncomingMessage } from 'http'\nimport {\n getOrCreateMcpServer,\n type McpServerOptions,\n} from './get-or-create …mcpServer = new McpServer({{"version":3,"sources":["../../../../src/server/mcp/get-or-create-mcp-server.ts"],"sourcesContent":["import { McpServer } from 'next/dist/compiled/@modelcontextprotocol/sdk/server/mcp'\nimport { registerGetProjectMetadataTool } from './tool …server.registerTool('compile_route', {{"version":3,"sources":["../../../../../src/server/mcp/tools/compile-route.ts"],"sourcesContent":["/**\n * MCP tool for compiling a specific route via the on-demand entry handler.\n *\n * Triggers on-demand compilation so the route's assets …server.registerTool('get_compilation_issues', {{"version":3,"sources":["../../../../../src/server/mcp/tools/get-compilation-issues.ts"],"sourcesContent":["/**\n * MCP tool for getting compilation issues from all routes via Turbopack.\n *\n * Unlike get_errors (which requires a browser s …server.registerTool('get_errors', {{"version":3,"sources":["../../../../../src/server/mcp/tools/get-errors.ts"],"sourcesContent":["/**\n * MCP tool for retrieving error state from Next.js dev server.\n *\n * This tool provides comprehensive error reporting including:\n * - N …server.registerTool('get_logs', {{"version":3,"sources":["../../../../../src/server/mcp/tools/get-logs.ts"],"sourcesContent":["/**\n * MCP tool for getting the path to the Next.js development log file.\n *\n * This tool returns the path to the {nextConfig.distDir}/logs/nex …server.registerTool('get_page_metadata', {{"version":3,"sources":["../../../../../src/server/mcp/tools/get-page-metadata.ts"],"sourcesContent":["import type { McpServer } from 'next/dist/compiled/@modelcontextprotocol/sdk/server/mcp'\nimport {\n HMR_MESSAGE_SENT_TO_BROWSER,\n typ …server.registerTool('get_project_metadata', {{"version":3,"sources":["../../../../../src/server/mcp/tools/get-project-metadata.ts"],"sourcesContent":["import type { McpServer } from 'next/dist/compiled/@modelcontextprotocol/sdk/server/mcp'\nimport { mcpTelemetryTracker } from '../mcp- …server.registerTool('get_request_insights', {{"version":3,"sources":["../../../../../src/server/mcp/tools/get-request-insights.ts"],"sourcesContent":["import type { McpServer } from 'next/dist/compiled/@modelcontextprotocol/sdk/server/mcp'\nimport z from 'next/dist/compiled/zod'\nimpo …server.registerTool('get_routes', {Why it matters: Just context — review which tools it offers and their permissions.
Fix: Review the declared MCP tools and their permissions.
How attackers abuse these capabilities
Interactive labs on the attack class behind the rules above. They show the technique, not anything found in Next.js.
Maintain Next.js?
The free Claude Code plugin scans each npm, PyPI or MCP package with this report's open-source engine before the install command runs. It runs on your machine and needs no account.
Check your own component
Run the same evidence-backed scan on any MCP server, agent skill, or package.
Scan your own componentHow we determine this: deterministic static analysis (regex + AST), evidence-anchored, no code execution. Methodology →