[{"data":1,"prerenderedAt":467},["ShallowReactive",2],{"switcher-blog-pareja":3,"art-npm-v12-security-supply-chain-en":6},{"en":4,"es":5},"\u002Fen\u002Fblog\u002Fnpm-v12-security-supply-chain\u002F","\u002Fes\u002Fblog\u002Fnpm-v12-seguridad-supply-chain\u002F",{"id":7,"title":8,"author":9,"body":10,"date":453,"description":454,"extension":455,"image":456,"meta":457,"navigation":262,"pareja":458,"path":459,"seo":460,"stem":461,"tags":462,"__hash__":466},"blogEn\u002Fen\u002Fblog\u002Fnpm-v12-security-supply-chain.md","npm stops trusting by default: what npm 12 changes and why you should get ready now","Paco Cubel",{"type":11,"value":12,"toc":438},"minimark",[13,18,22,39,43,58,81,85,92,134,137,141,169,173,176,181,203,210,229,233,236,286,292,296,308,318,322,351,355,370,374,377,399,405,409,434],[14,15,17],"h2",{"id":16},"from-i-trust-everything-to-approve-what-you-run","From \"I trust everything\" to \"approve what you run\"",[19,20,21],"p",{},"If you follow security news, the past year on npm has been one scare after another: self-spreading worms, libraries with a hundred million weekly downloads compromised for a few hours, and maintainer accounts hijacked to slip malicious code into the supply chain. Yesterday GitHub — which maintains npm — made its move with what is probably the deepest overhaul of the package manager in years.",[19,23,24,25,29,30,34,35,38],{},"The core idea is simple and long overdue: ",[26,27,28],"strong",{},"npm will stop trusting by default",". What today runs automatically on ",[31,32,33],"code",{},"npm install"," will now need your explicit approval. It lands in ",[26,36,37],{},"npm 12, due in July",", and if you manage servers, CI pipelines or any Node app in production, this one's for you.",[14,40,42],{"id":41},"why-now-the-wave-of-poisoned-packages","Why now: the wave of poisoned packages",[19,44,45,46,49,50,53,54,57],{},"The trigger isn't a single case, it's a pattern. The loudest was ",[26,47,48],{},"Shai-Hulud",", malware that behaves like a ",[26,51,52],{},"self-propagating worm",": it runs during the ",[31,55,56],{},"preinstall"," phase, steals credentials (GitHub tokens, AWS, GCP and Azure keys, CI\u002FCD secrets) and uses them to publish more infected packages and spin up malicious repositories, chaining the infection along. Its second wave racked up hundreds of compromised packages and over 25,000 automatically created repositories.",[19,59,60,61,64,65,68,69,72,73,76,77,80],{},"Add to that the hijacking of ",[26,62,63],{},"axios"," (one of the ecosystem's most used libraries), malicious packages published under corporate namespaces like ",[26,66,67],{},"@redhat-cloud-services"," off a compromised account, and smaller variants such as ",[26,70,71],{},"@tanstack"," or ",[26,74,75],{},"@antv",". The vector keeps repeating: ",[26,78,79],{},"a script that runs on install",", or a dependency pointing at a Git repo or a URL you never reviewed.",[14,82,84],{"id":83},"what-npm-12-changes-the-three-breaking-changes","What npm 12 changes (the three breaking changes)",[19,86,87,88,91],{},"GitHub frames it as the shift from ",[26,89,90],{},"implicit trust to explicit consent",". Specifically:",[93,94,95,120,128],"ol",{},[96,97,98,101,102,104,105,107,108,111,112,115,116,119],"li",{},[26,99,100],{},"Install scripts won't run by default."," ",[31,103,33],{}," will stop running your dependencies' ",[31,106,56],{},", ",[31,109,110],{},"install"," and ",[31,113,114],{},"postinstall"," scripts — along with native module builds and ",[31,117,118],{},"prepare"," scripts from Git or local paths — unless you approve them explicitly. That closes the exact door Shai-Hulud walked through.",[96,121,122,101,125,127],{},[26,123,124],{},"Git dependencies blocked.",[31,126,33],{}," will no longer fetch dependencies pointing at Git repositories, direct or transitive, without permission. So long to a comfortable path for injecting code that never touches the registry.",[96,129,130,133],{},[26,131,132],{},"Remote URL dependencies blocked."," Packages served from a URL (HTTPS tarballs) won't resolve without authorization either, again both direct and transitive.",[19,135,136],{},"In short: what used to happen \"on its own\" will now happen because you said so.",[14,138,140],{"id":139},"whos-affected","Who's affected",[142,143,144,153,162],"ul",{},[96,145,146,152],{},[26,147,148,149,151],{},"Anyone running ",[31,150,33],{}," on a server or in CI",", which today is basically any deployment with a modern frontend or a Node backend.",[96,154,155,158,159,161],{},[26,156,157],{},"CI\u002FCD pipelines especially",", where a malicious ",[31,160,114],{}," has access to environment variables, tokens and keys. That's where it does the most damage and what these changes protect best.",[96,163,164,165,168],{},"And projects relying on ",[26,166,167],{},"Git or URL dependencies"," (internal forks, private packages without a registry): they'll still work, but you'll have to declare them. Better to find out now than when the build stops in red.",[14,170,172],{"id":171},"what-you-can-do-today-without-waiting-for-v12","What you can do today, without waiting for v12",[19,174,175],{},"You don't need to wait until July to shrink your attack surface. These already work:",[177,178,180],"h3",{"id":179},"_1-check-which-npm-version-youre-on","1. Check which npm version you're on",[182,183,188],"pre",{"className":184,"code":185,"language":186,"meta":187,"style":187},"language-bash shiki shiki-themes github-dark-high-contrast","npm --version\n","bash","",[31,189,190],{"__ignoreMap":187},[191,192,195,199],"span",{"class":193,"line":194},"line",1,[191,196,198],{"class":197},"s_sBn","npm",[191,200,202],{"class":201},"sCcAr"," --version\n",[19,204,205,206,209],{},"Move to ",[26,207,208],{},"npm 11.16.0 or newer"," to start seeing warnings about which of your workflows v12 would affect:",[182,211,213],{"className":184,"code":212,"language":186,"meta":187,"style":187},"npm install -g npm@latest\n",[31,214,215],{"__ignoreMap":187},[191,216,217,219,223,226],{"class":193,"line":194},[191,218,198],{"class":197},[191,220,222],{"class":221},"sTRMh"," install",[191,224,225],{"class":201}," -g",[191,227,228],{"class":221}," npm@latest\n",[177,230,232],{"id":231},"_2-disable-install-scripts-where-you-dont-need-them","2. Disable install scripts where you don't need them",[19,234,235],{},"In CI and reproducible deployments you almost never need dependencies to run scripts:",[182,237,239],{"className":184,"code":238,"language":186,"meta":187,"style":187},"# One-off install without running scripts\nnpm install --ignore-scripts\n\n# Or permanently in the project (.npmrc)\necho \"ignore-scripts=true\" >> .npmrc\n",[31,240,241,247,257,264,270],{"__ignoreMap":187},[191,242,243],{"class":193,"line":194},[191,244,246],{"class":245},"sQrFR","# One-off install without running scripts\n",[191,248,250,252,254],{"class":193,"line":249},2,[191,251,198],{"class":197},[191,253,222],{"class":221},[191,255,256],{"class":201}," --ignore-scripts\n",[191,258,260],{"class":193,"line":259},3,[191,261,263],{"emptyLinePlaceholder":262},true,"\n",[191,265,267],{"class":193,"line":266},4,[191,268,269],{"class":245},"# Or permanently in the project (.npmrc)\n",[191,271,273,276,279,283],{"class":193,"line":272},5,[191,274,275],{"class":201},"echo",[191,277,278],{"class":221}," \"ignore-scripts=true\"",[191,280,282],{"class":281},"sWyjQ"," >>",[191,284,285],{"class":221}," .npmrc\n",[19,287,288,289,291],{},"If a legitimate package genuinely needs its ",[31,290,114],{}," (say, one with a native binary), you approve it in a controlled way instead of leaving the door open for everyone.",[177,293,295],{"id":294},"_3-use-deterministic-installs-in-ci","3. Use deterministic installs in CI",[182,297,299],{"className":184,"code":298,"language":186,"meta":187,"style":187},"npm ci\n",[31,300,301],{"__ignoreMap":187},[191,302,303,305],{"class":193,"line":194},[191,304,198],{"class":197},[191,306,307],{"class":221}," ci\n",[19,309,310,313,314,317],{},[31,311,312],{},"npm ci"," installs exactly what ",[31,315,316],{},"package-lock.json"," says, without resolving new versions. Less room for a freshly published, compromised version to sneak in unnoticed.",[177,319,321],{"id":320},"_4-pin-and-watch","4. Pin and watch",[142,323,324,338,344],{},[96,325,326,329,330,333,334,337],{},[26,327,328],{},"Pin versions"," (avoid wide ranges ",[31,331,332],{},"^","\u002F",[31,335,336],{},"~"," on sensitive dependencies).",[96,339,340,341,343],{},"Turn on dependency alerts (Dependabot) and review which packages ship a ",[31,342,114],{},".",[96,345,346,347,350],{},"As soon as npm 12 ships, ",[26,348,349],{},"inventory the scripts and the Git\u002FURL dependencies"," you actually use and approve them explicitly. Doing that homework calmly, before you upgrade, saves you the stopped-build scare.",[14,352,354],{"id":353},"what-we-do","What we do",[19,356,357,358,111,360,363,364,366,367,369],{},"On the deployments we manage, dependency installs run with ",[31,359,312],{},[31,361,362],{},"--ignore-scripts"," by default, and legitimate ",[31,365,114],{}," scripts get approved one by one. It isn't paranoia: the cost of reviewing a handful of packages is laughable next to a ",[31,368,56],{}," walking off with the server's keys. npm 12 heads in exactly that direction, so for us it isn't a change — it's the rule turned into the default.",[14,371,373],{"id":372},"the-same-old-routine","The same old routine",[19,375,376],{},"With the supply chain, the moves look a lot like any other patch:",[142,378,379,385,388,396],{},[96,380,381,384],{},[31,382,383],{},"npm --version"," to know where you stand.",[96,386,387],{},"Move to 11.16.0+ to see the warnings.",[96,389,390,392,393,395],{},[31,391,362],{}," \u002F ",[31,394,312],{}," in CI and deployments.",[96,397,398],{},"Inventory scripts and Git\u002FURL dependencies before jumping to v12.",[19,400,401,402,404],{},"Trust by default was convenient, but the bill was paid by whoever had the bad luck to install the wrong package on the wrong day. If you're not sure what your ",[31,403,33],{}," runs in production or CI, it's a good time to look. And if you'd rather we review it for you, let's talk.",[14,406,408],{"id":407},"references","References",[142,410,411,420,427],{},[96,412,413],{},[414,415,419],"a",{"href":416,"rel":417},"https:\u002F\u002Fwww.bleepingcomputer.com\u002Fnews\u002Fsecurity\u002Fgithub-announces-npm-security-changes-to-tackle-supply-chain-attacks\u002F",[418],"nofollow","GitHub announces npm security changes to tackle supply-chain attacks — BleepingComputer",[96,421,422],{},[414,423,426],{"href":424,"rel":425},"https:\u002F\u002Fwww.wiz.io\u002Fblog\u002Fshai-hulud-2-0-ongoing-supply-chain-attack",[418],"Shai-Hulud 2.0: ongoing supply chain attack — Wiz",[96,428,429],{},[414,430,433],{"href":431,"rel":432},"https:\u002F\u002Funit42.paloaltonetworks.com\u002Fmonitoring-npm-supply-chain-attacks\u002F",[418],"The npm Threat Landscape — Unit 42 (Palo Alto)",[435,436,437],"style",{},"html pre.shiki code .s_sBn, html code.shiki .s_sBn{--shiki-default:#FFB757}html pre.shiki code .sCcAr, html code.shiki .sCcAr{--shiki-default:#91CBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sTRMh, html code.shiki .sTRMh{--shiki-default:#ADDCFF}html pre.shiki code .sQrFR, html code.shiki .sQrFR{--shiki-default:#BDC4CC}html pre.shiki code .sWyjQ, html code.shiki .sWyjQ{--shiki-default:#FF9492}",{"title":187,"searchDepth":249,"depth":249,"links":439},[440,441,442,443,444,450,451,452],{"id":16,"depth":249,"text":17},{"id":41,"depth":249,"text":42},{"id":83,"depth":249,"text":84},{"id":139,"depth":249,"text":140},{"id":171,"depth":249,"text":172,"children":445},[446,447,448,449],{"id":179,"depth":259,"text":180},{"id":231,"depth":259,"text":232},{"id":294,"depth":259,"text":295},{"id":320,"depth":259,"text":321},{"id":353,"depth":249,"text":354},{"id":372,"depth":249,"text":373},{"id":407,"depth":249,"text":408},"2026-06-11","After the latest wave of poisoned npm packages, GitHub is bringing three breaking changes in npm 12: install scripts off by default, Git dependencies blocked and remote URL tarballs banned unless you approve them explicitly. Here's what breaks in your deployments and how to arrive prepared.","md","\u002Fog\u002Fog-default.png",{},"npm-v12-seguridad-supply-chain","\u002Fen\u002Fblog\u002Fnpm-v12-security-supply-chain",{"title":8,"description":454},"en\u002Fblog\u002Fnpm-v12-security-supply-chain",[198,463,464,465],"Security","Supply Chain","DevOps","LhmMD_A7byOy6Z5U_aSE7EKti_xP-JdUyRjwsjCRPT4",1784782834867]