Skip to content

LS-NPMRC-001: npmrc Auth Token

Severity HIGH
Blast radius Package registry supply-chain compromise
Rotate at https://www.npmjs.com/settings/~/tokens
Applies to files matching (?:^|/)\.npmrc$

If this leaks

A registry auth token committed in .npmrc lets anyone publish or install private packages as you.

What to do

  1. Rotate or revoke the credential at https://www.npmjs.com/settings/~/tokens.
  2. Check the provider's audit logs for use you don't recognise.
  3. Remove it from git history (leakscan purge --help) and load it from an environment variable or secret manager instead.

Pattern

(?i)_auth(?:Token)?\s*=\s*['\"]?([A-Za-z0-9+/=_\-]{20,})

Suppress

On one line: # leakscan:ignore LS-NPMRC-001. For the whole project:

disable_rules: [LS-NPMRC-001]