Skip to content
MediumSecrets & credentialsBLWK-CRED-006

An npm token is stored in plain text (‹path›) ​

What this means ​

‹path› contains ‹plaintext tokens› registry login(s) written out in full. A publish token in this file lets anyone who copies it push packages under your name, which is how several 2025-2026 npm worms spread from one developer machine to thousands of projects.

How to fix it ​

  1. Revoke the token on the registry and create a granular token with an expiry and only the packages it needs.
  2. Reference it from the environment instead of writing it down: //registry.npmjs.org/:_authToken=${NPM_TOKEN}.
  3. For publishing from CI, prefer trusted publishing (OIDC), which needs no long-lived token at all.

Check it yourself ​

Run a scan and look for BLWK-CRED-006 in the results:

sh
bulwark scan

Installed the standalone CLI package instead of the app? The command is bulwarkctl.

How Bulwark decides

Bulwark reads credential_stores and reports this check when:

text
kind == "npmrc" and plaintext_tokens > 0

If a value can't be read, Bulwark reports the check as undetermined rather than passing it. View the rule source.

References ​

Released under the Apache License 2.0.