<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vivek Sharma</title>
    <description>The latest articles on DEV Community by Vivek Sharma (@viveks0530).</description>
    <link>https://dev.to/viveks0530</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F491725%2F75b558d0-843e-40f4-ba9b-6f116ba5dc2b.jpg</url>
      <title>DEV Community: Vivek Sharma</title>
      <link>https://dev.to/viveks0530</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/viveks0530"/>
    <language>en</language>
    <item>
      <title>Five npm supply chain habits that take ten minutes</title>
      <dc:creator>Vivek Sharma</dc:creator>
      <pubDate>Fri, 27 Nov 2026 10:00:00 +0000</pubDate>
      <link>https://dev.to/viveks0530/five-npm-supply-chain-habits-that-take-ten-minutes-2cp4</link>
      <guid>https://dev.to/viveks0530/five-npm-supply-chain-habits-that-take-ten-minutes-2cp4</guid>
      <description>&lt;p&gt;In September 2025, an attacker phished the credentials of a single npm maintainer and published poisoned versions of &lt;code&gt;chalk&lt;/code&gt;, &lt;code&gt;debug&lt;/code&gt; and around a dozen other packages. According to &lt;a href="https://github.blog/security/supply-chain-security/the-case-for-a-cooldown-why-dependabot-now-waits-before-issuing-version-updates/" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;, the poisoned versions were live for roughly two hours before they were caught and pulled. The same post notes that compromised builds of Solana web3.js, Axios and ua-parser-js were each caught within a few hours.&lt;/p&gt;

&lt;p&gt;Windows that short are why a few defaults help. None of these habits makes you safe, but each reduces what a fresh malicious release can reach. For most projects, each is a command or one line of config.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Install from the lockfile
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;npm ci&lt;/code&gt; installs exactly what the lockfile says. Per the &lt;a href="https://docs.npmjs.com/cli/v11/commands/npm-ci" rel="noopener noreferrer"&gt;npm docs&lt;/a&gt;, if the dependencies in the lockfile do not match &lt;code&gt;package.json&lt;/code&gt;, it exits with an error instead of updating the lockfile. It also removes an existing &lt;code&gt;node_modules&lt;/code&gt; before installing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm ci
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The equivalents are &lt;code&gt;pnpm install --frozen-lockfile&lt;/code&gt; (&lt;a href="https://pnpm.io/cli/install" rel="noopener noreferrer"&gt;pnpm docs&lt;/a&gt;) and &lt;code&gt;yarn install --immutable&lt;/code&gt; (&lt;a href="https://yarnpkg.com/cli/install" rel="noopener noreferrer"&gt;Yarn docs&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Use these in CI and in your Docker build, so a build never silently picks up a newer version than the one you reviewed.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Wait a few days for new versions
&lt;/h2&gt;

&lt;p&gt;A new release is the riskiest version of a package, because nobody has had time to notice a problem. Most tools now have a setting that skips versions younger than a set age:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Setting&lt;/th&gt;
&lt;th&gt;Unit&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;npm&lt;/td&gt;
&lt;td&gt;&lt;code&gt;min-release-age&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;days (default &lt;code&gt;null&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pnpm&lt;/td&gt;
&lt;td&gt;&lt;code&gt;minimumReleaseAge&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;minutes (default 1440, one day)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yarn&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npmMinimalAgeGate&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;duration string, for example &lt;code&gt;"1w"&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Renovate&lt;/td&gt;
&lt;td&gt;&lt;code&gt;minimumReleaseAge&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;duration string, for example &lt;code&gt;"3 days"&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dependabot&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cooldown&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;days&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For npm, the &lt;a href="https://docs.npmjs.com/cli/v11/using-npm/config" rel="noopener noreferrer"&gt;config docs&lt;/a&gt; say that only versions published more than the given number of days ago will be installed, and that the command errors if no version of a dependency is old enough. The setting is in npm 11.10 and later.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="c1"&gt;# .npmrc
&lt;/span&gt;&lt;span class="na"&gt;min-release-age&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# pnpm-workspace.yaml (minutes; 10080 is one week)
&lt;/span&gt;&lt;span class="na"&gt;minimumReleaseAge&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10080&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# .github/dependabot.yml
&lt;/span&gt;&lt;span class="na"&gt;updates&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;package-ecosystem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm&lt;/span&gt;
    &lt;span class="na"&gt;directory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/&lt;/span&gt;
    &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;interval&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;weekly&lt;/span&gt;
    &lt;span class="na"&gt;cooldown&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;default-days&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dependabot already waits three days by default for version updates, according to its &lt;a href="https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference" rel="noopener noreferrer"&gt;options reference&lt;/a&gt;. Security updates are not delayed.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Check your install scripts
&lt;/h2&gt;

&lt;p&gt;By default, a package can run code on your machine at install time through lifecycle scripts such as &lt;code&gt;preinstall&lt;/code&gt; and &lt;code&gt;postinstall&lt;/code&gt;. The tools differ:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;npm 10 and 11&lt;/strong&gt; run dependency install scripts by default (&lt;code&gt;ignore-scripts&lt;/code&gt; defaults to &lt;code&gt;false&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;npm 12&lt;/strong&gt; (released 8 July 2026) blocks dependency lifecycle scripts by default unless the root package's &lt;code&gt;allowScripts&lt;/code&gt; policy allows them. The &lt;a href="https://github.com/npm/cli/blob/latest/CHANGELOG.md" rel="noopener noreferrer"&gt;CLI changelog&lt;/a&gt; says to run &lt;code&gt;npm install-scripts approve&lt;/code&gt; after installing to record approvals.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pnpm 10&lt;/strong&gt; stopped running dependency scripts by default (&lt;a href="https://github.com/pnpm/pnpm/releases/tag/v10.0.0" rel="noopener noreferrer"&gt;release notes&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yarn 4.14&lt;/strong&gt; made &lt;code&gt;enableScripts: false&lt;/code&gt; the default (&lt;a href="https://github.com/yarnpkg/berry/releases/tag/%40yarnpkg%2Fcli%2F4.14.0" rel="noopener noreferrer"&gt;release notes&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which npm you have depends on your Node version. On 20 Nov 2026, the npm bundled with Node 22.23.5 is 10.9.9, with Node 24.22.3 is 11.19.1, and with Node 26.13.1 is 11.20.0 (&lt;a href="https://nodejs.org/dist/index.json" rel="noopener noreferrer"&gt;&lt;code&gt;nodejs.org/dist/index.json&lt;/code&gt;&lt;/a&gt;). In &lt;a href="https://github.com/nodejs/Release/issues/1161" rel="noopener noreferrer"&gt;nodejs/Release issue 1161&lt;/a&gt;, a Release WG member wrote on 13 Aug 2026 that the group had decided not to land npm 12 on Node.js 26, 24 or 22. So unless you upgrade npm yourself, you are on the "scripts run by default" side.&lt;/p&gt;

&lt;p&gt;Check, and try an install without scripts to see what depends on them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm --version
npm ci --ignore-scripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Packages that fail or lose a binary are the ones that need scripts. Decide per package whether to allow them.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Verify signatures
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;npm audit signatures&lt;/code&gt; verifies the registry signatures and the provenance attestations of the packages you installed (&lt;a href="https://docs.npmjs.com/cli/v11/commands/npm-audit" rel="noopener noreferrer"&gt;npm docs&lt;/a&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm audit signatures
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read the limits carefully. The npm docs on &lt;a href="https://docs.npmjs.com/generating-provenance-statements" rel="noopener noreferrer"&gt;provenance&lt;/a&gt; say it does not guarantee the package has no malicious code. It gives a verifiable link to the package's source code and build instructions. Treat it as one signal alongside habits 1 to 3.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. If you publish: no long-lived tokens
&lt;/h2&gt;

&lt;p&gt;If you maintain packages, a stolen publish token is how a malicious release happens. &lt;a href="https://docs.npmjs.com/trusted-publishers" rel="noopener noreferrer"&gt;Trusted publishing&lt;/a&gt; lets your CI publish with short-lived OpenID Connect credentials instead of a stored npm token. It needs npm CLI 11.5.1 or later and Node 22.14.0 or later, and supports GitHub Actions (GitHub-hosted runners), GitLab CI/CD (GitLab.com shared runners) and CircleCI cloud. Self-hosted runners are not currently supported.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this does not cover
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Vulnerability scanning of known-bad versions (&lt;code&gt;npm audit&lt;/code&gt;), which answers a different question.&lt;/li&gt;
&lt;li&gt;Reviewing the code of every dependency, which does not scale.&lt;/li&gt;
&lt;li&gt;The "ten minutes" in the title is an estimate for a typical project. Habit 3 can take longer if many dependencies rely on install scripts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Checklist
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;npm ci&lt;/code&gt; (or the pnpm and Yarn equivalents) in CI and Docker builds.&lt;/li&gt;
&lt;li&gt;A release-age setting in your package manager or update bot.&lt;/li&gt;
&lt;li&gt;Know your npm version and try &lt;code&gt;npm ci --ignore-scripts&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npm audit signatures&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Publishers: switch to trusted publishing.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.blog/security/supply-chain-security/the-case-for-a-cooldown-why-dependabot-now-waits-before-issuing-version-updates/" rel="noopener noreferrer"&gt;The case for a cooldown&lt;/a&gt;, GitHub Blog&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.npmjs.com/cli/v11/commands/npm-ci" rel="noopener noreferrer"&gt;&lt;code&gt;npm ci&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://docs.npmjs.com/cli/v11/using-npm/config" rel="noopener noreferrer"&gt;config&lt;/a&gt;, &lt;a href="https://docs.npmjs.com/cli/v11/commands/npm-audit" rel="noopener noreferrer"&gt;&lt;code&gt;npm audit&lt;/code&gt;&lt;/a&gt;, npm docs&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.npmjs.com/generating-provenance-statements" rel="noopener noreferrer"&gt;Generating provenance statements&lt;/a&gt;, &lt;a href="https://docs.npmjs.com/trusted-publishers" rel="noopener noreferrer"&gt;Trusted publishing&lt;/a&gt;, npm docs&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/npm/cli/blob/latest/CHANGELOG.md" rel="noopener noreferrer"&gt;npm CLI changelog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/nodejs/Release/issues/1161" rel="noopener noreferrer"&gt;nodejs/Release issue 1161&lt;/a&gt;, &lt;a href="https://nodejs.org/dist/index.json" rel="noopener noreferrer"&gt;Node.js release index&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://pnpm.io/cli/install" rel="noopener noreferrer"&gt;pnpm &lt;code&gt;install&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://pnpm.io/supply-chain-security" rel="noopener noreferrer"&gt;pnpm supply chain security&lt;/a&gt;, &lt;a href="https://yarnpkg.com/cli/install" rel="noopener noreferrer"&gt;Yarn &lt;code&gt;install&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://yarnpkg.com/configuration/yarnrc" rel="noopener noreferrer"&gt;Yarn configuration&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference" rel="noopener noreferrer"&gt;Dependabot options reference&lt;/a&gt;, &lt;a href="https://docs.renovatebot.com/configuration-options/#minimumreleaseage" rel="noopener noreferrer"&gt;Renovate &lt;code&gt;minimumReleaseAge&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Disclosure: this article was drafted with the help of AI and fact-checked against the sources linked above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>npm</category>
      <category>javascript</category>
      <category>security</category>
      <category>node</category>
    </item>
    <item>
      <title>What I Learned From Hacktoberfest</title>
      <dc:creator>Vivek Sharma</dc:creator>
      <pubDate>Fri, 16 Oct 2020 13:35:27 +0000</pubDate>
      <link>https://dev.to/viveks0530/what-i-learned-from-hacktoberfest-2kh9</link>
      <guid>https://dev.to/viveks0530/what-i-learned-from-hacktoberfest-2kh9</guid>
      <description>&lt;h2&gt;
  
  
  What I Learned From Hacktoberfest?
&lt;/h2&gt;

&lt;p&gt;I have learnt so many things from the hacktoberfest first I have learnt that how to create the pull request and I also learnt that how to contribute in the open source project by using your understandings of programming. &lt;/p&gt;

</description>
      <category>hacktoberfest</category>
    </item>
  </channel>
</rss>
