Living Off The Ecosystem
The implicit attack surface. Files, env vars, flags and hooks that run on install, at startup, on import, and when a command starts.
Install time
- npm lifecycle scriptsInstall hook
scripts field in package.json - binding.gyp / node-gyp native compilationInstall hook
binding.gyp file in the package root - Corepack (packageManager field)File
"packageManager" field in package.json, COREPACK_HOME cache directory - .npmrc registry manipulationFile
.npmrc file (project, user, or global) - overrides / resolutions dependency swapFile
overrides (npm) or resolutions (Yarn) field in package.json - pnpm hooks (pnpmfile.cjs)Install hook
.pnpmfile.cjs in the project root - .yarnrc.yml plugins and registryFile
.yarnrc.yml in the project root - node_modules/.hooks/ directoryInstall hook · deprecated
node_modules/.hooks/ directory
Interpreter startup
Module resolution
- .node native addon loadingFile
.node files in node_modules/ (typically under build/Release/ or prebuilds/) - Yarn Plug'n'Play (.pnp.cjs)File
.pnp.cjs in the project root - NODE_PATH environment variableEnv var
NODE_PATH environment variable - "imports" field (subpath imports)File
imports field in package.json - require.extensions / Module._extensionsModule hook · deprecated
require.extensions / Module._extensions in any loaded module