Home / Companies / Semgrep / Blog / Post Details
Content Deep Dive

RIP post/preinstall scripts: An obituary for the npm feature only TeamPCP will miss

Blog post from Semgrep

Post Details
Company
Date Published
Author
Katie Paxton-Fear
Word Count
1,363
Company Posts That Month
10
Language
English
Hacker News Points
-
Post removed?
No
Summary

npm, the default package manager for Node.js and one of the largest software registries, has long faced criticism for its automatic execution of lifecycle scripts during package installations, which posed significant security risks. This feature allowed arbitrary shell scripts from third-party code to run without user consent, a vulnerability exploited in numerous supply chain attacks. These attacks often involved compromised packages delivering malware via postinstall scripts, even affecting packages buried deep in dependency trees. In response to these security issues, npm v12 will default to disabling these scripts, requiring explicit user permission to run them, aligning with the practices of other package managers like pnpm, Bun, and Yarn. While legitimate use cases for lifecycle scripts existed, such as compiling native addons or downloading binaries, the default trust model left systems exposed to attacks like the infamous Axios incident. Despite years of calls for change, npm's shift to a safer default setting marks a significant step in securing the JavaScript ecosystem, though other supply chain threats persist.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Secrets Management 1 2,476 387 132 +15%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.