{"id":1264,"date":"2026-06-11T07:37:21","date_gmt":"2026-06-11T07:37:21","guid":{"rendered":"https:\/\/thedigitalfortress.us\/?p=1264"},"modified":"2026-06-11T07:37:21","modified_gmt":"2026-06-11T07:37:21","slug":"github-to-disable-npm-install-scripts-by-default-to-stop-supply-chain-attacks","status":"publish","type":"post","link":"https:\/\/thedigitalfortress.us\/?p=1264","title":{"rendered":"GitHub to Disable npm Install Scripts by Default to Stop Supply Chain Attacks"},"content":{"rendered":"<div>\n<p><span class=\"p-author\"><i class=\"icon-font icon-user\">\ue804<\/i><span class=\"author\">Ravie Lakshmanan<\/span><i class=\"icon-font icon-calendar\">\ue802<\/i><span class=\"author\">Jun 11, 2026<\/span><\/span><span class=\"p-tags\">Developer Security \/ Software Supply Chain<\/span><\/p>\n<\/div>\n<div id=\"articlebody\">\n<div class=\"separator\" style=\"clear: both;\"><a href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEi_yyoUTLr71Ug2Ge0R7qFSnlGjB3TzlrQ-2NDR5jpPSBjivUSxhxRV1eCg5E6Af15RbJLZpqg9Ohp9ZW9YC9D2oc3VcHrNYQetavvvarn-Pn1P4VWnMw2C-hXbFgplFW9O8pe-zSP9ABGkkR-LM8hhu370dXMgeV-TGQT2p9N7hd7Friim3UkdK5FfyHHp\/s1700-e365\/npm-github.jpg\" style=\"clear: left; display: block; float: left;  text-align: center;\"><\/a><\/div>\n<p>GitHub has <a href=\"https:\/\/github.blog\/changelog\/2026-06-09-upcoming-breaking-changes-for-npm-v12\/\">announced<\/a> what it said are \u00abbreaking changes\u00bb coming to npm version 12, one of which turns off install scripts by default to combat software supply chain threats.<\/p>\n<p>The changes aim to combat attack techniques that abuse the \u00abnpm install\u00bb command to trigger the execution of malicious code using npm lifecycle hooks. \u00abNpm install\u00bb is used to download and install all the necessary dependencies for a Node.js project. Version 12 is scheduled for release next month.<\/p>\n<p>Describing install-time lifecycle scripts as the \u00absingle largest code-execution surface in the npm ecosystem,\u00bb GitHub <a href=\"https:\/\/github.com\/orgs\/community\/discussions\/198547\">said<\/a> the \u00abnpm install\u00bb command runs scripts from every transitive dependency, as a result of which a single compromised package anywhere in the dependency tree can run arbitrary code on a developer machine or CI runner.<\/p>\n<div class=\"dog_two clear\">\n<div class=\"cf\"><a href=\"https:\/\/thehackernews.uk\/ai-cant-stop-d\" rel=\"nofollow noopener sponsored\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"lazyload\" alt=\"Cybersecurity\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEjPEV6-530TOlxG6PjrmdlY623wpBwduZ7t1HV6flcmO5R4q4AmfixDUzW0CrhlvMVNWbhvOIso-UDNTka4W_W9Chrdj_dglwBZwi7DuePM2IMIl-hfUYVIqBXgfpr_2619K8Gptb4LzwJ6gUbi7lWl2M8AFQJsHEaw63Q7tZ6708YGruiHrr0Y2W9YYxLQ\/s728-e100\/ThreatLocker-d.png\" width=\"729\" height=\"91\"\/><\/a><\/div>\n<\/div>\n<p>By blocking such behaviours, the idea is to require explicit user approval before code execution is initiated automatically during \u00abnpm install\u00bb as opposed to being trusted by default. \u00abMaking script execution opt-in closes that path while keeping it one command away for the packages you trust,\u00bb GitHub said.<\/p>\n<p>The changes are listed below &#8211;<\/p>\n<ul>\n<li>npm install will no longer execute preinstall, install, or postinstall scripts from dependencies unless they are explicitly allowed in the project.<\/li>\n<li>npm install will no longer resolve Git dependencies, either direct or transitive, unless explicitly allowed via &#8211;allow-git.<\/li>\n<li>npm install will no longer resolve dependencies from remote URLs, such as https tarballs, unless explicitly allowed via &#8211;allow-remote.<\/li>\n<\/ul>\n<p>\u00abThis includes native node-gyp builds (i.e., a package with a binding.gyp and no explicit install script still gets blocked, because npm runs an implicit node-gyp rebuild for it),\u00bb the Microsoft-owned subsidiary said about changes to the default \u00aballowScripts\u00bb behavior. \u00abprepare scripts from git, file, and link dependencies are blocked the same way.\u00bb<\/p>\n<p>By defaulting \u00ab&#8211;allow-git\u00bb to \u00abnone,\u00bb the setting closes out a code execution path where a Git dependency&#8217;s .npmrc configuration file used could override the Git executable, even with <a href=\"https:\/\/www.nodejs-security.com\/blog\/npm-ignore-scripts-best-practices-as-security-mitigation-for-malicious-packages\">&#8211;ignore-scripts<\/a>, a flag that prevents packages specified in a package.json file from automatically running built-in lifecycle scripts during the installation process.<\/p>\n<div class=\"dog_two clear\">\n<div class=\"cf\"><a href=\"https:\/\/thehackernews.uk\/vpn-threat-report-m\" rel=\"nofollow noopener sponsored\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"lazyload\" alt=\"Cybersecurity\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhFlTC7RrRZGiFAgASS0noWSL0qsQGFVp8-Hvuw9yp3X3VKRuTcb5SsPX09wJzrdIM6pu1_5lS4EeZp7Sx4iYBpNJkrGnpr08yyaS1HQ5_5TxaCsP6O0OtHNuOkesn6CbNjao1GPulCJk-uljYMSfMZfBYNrngpe669t7jlRn1FqiEnXhsFD1WVkpaYIVgh\/s728-e100\/ai-d.jpg\" width=\"729\" height=\"91\"\/><\/a><\/div>\n<\/div>\n<p>GitHub recommends that developers prepare for these changes by upgrading to npm 11.16.0 or newer, running the normal install, and reviewing the warnings displayed.<\/p>\n<p>\u00abUse npm approve-scripts &#8211;allow-scripts-pending to see which packages have scripts, approve the ones you trust, and commit the updated package.json,\u00bb it added. \u00abAfter that, only the scripts you approved keep running once you upgrade. Anything you leave unapproved will stop.\u00bb<\/p>\n<p>Earlier this year, npm also introduced \u00abmin-release-age,\u00bb a setting that tells npm to reject any package version published less than a specified number of days as a safeguard against newly published malicious packages.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\ue804Ravie Lakshmanan\ue802Jun 11, 2026Developer Security \/ Software Supply Chain GitHub has announced what it said are \u00abbreaking changes\u00bb coming to npm version 12, one of which turns off install scripts&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1265,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[24,219,1607,772,71,1779,39,1775,895,218],"class_list":["post-1264","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-attacks","tag-chain","tag-default","tag-disable","tag-github","tag-install","tag-npm","tag-scripts","tag-stop","tag-supply"],"_links":{"self":[{"href":"https:\/\/thedigitalfortress.us\/index.php?rest_route=\/wp\/v2\/posts\/1264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thedigitalfortress.us\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thedigitalfortress.us\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thedigitalfortress.us\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thedigitalfortress.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1264"}],"version-history":[{"count":0,"href":"https:\/\/thedigitalfortress.us\/index.php?rest_route=\/wp\/v2\/posts\/1264\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thedigitalfortress.us\/index.php?rest_route=\/wp\/v2\/media\/1265"}],"wp:attachment":[{"href":"https:\/\/thedigitalfortress.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thedigitalfortress.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thedigitalfortress.us\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}