Skip to content

🔒 security: disable postinstall scripts with trusted allowlist#625

Merged
futjesus merged 1 commit intomainfrom
chore/disable-postinstall-scripts
Apr 22, 2026
Merged

🔒 security: disable postinstall scripts with trusted allowlist#625
futjesus merged 1 commit intomainfrom
chore/disable-postinstall-scripts

Conversation

@futjesus
Copy link
Copy Markdown
Member

Summary

  • Add ignore-scripts=true to .npmrc so npm stops running postinstall scripts from dependencies automatically — mitigates the recent wave of compromised/malicious npm packages that abuse install-time hooks.
  • Add a setup npm script as the explicit allowlist for packages this project does need to build: npm rebuild esbuild (Vite's native binary) and husky (git hooks via the root prepare script, which is also blocked by ignore-scripts).
  • Document the new flow and allowlist policy in CLAUDE.md under a new Security section.

Test plan

  • rm -rf node_modules && npm install completes without executing dependency postinstall scripts.
  • npm run setup rebuilds esbuild and installs husky git hooks successfully.
  • npm run build succeeds after npm run setup (verifies esbuild binary is usable).
  • git commit triggers husky hooks (verifies husky was installed).

Set ignore-scripts=true in .npmrc to block arbitrary postinstall
execution from dependencies, and expose an npm run setup allowlist
(esbuild, husky) for the scripts the project actually needs.
@futjesus futjesus merged commit 6bb5125 into main Apr 22, 2026
1 check passed
@futjesus futjesus deleted the chore/disable-postinstall-scripts branch April 22, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant