How nullcipher recognises it
Checked only when the text contains “npm_” (any case). Pattern (gitleaks rule npm-access-token, v8.30.1, translated to JavaScript): /\b([Nn][Pp][Mm]_[0-9A-Za-z]{36})(?:[\s"';`]|\\[NRnr]|$)/ — the first capture group is masked; any surrounding key name stays readable. The masked part must have a Shannon entropy above 2 bits per character, so repetitive placeholders like xxxx are left alone.
This is the rule text of the “npm access token” detector in the masking engine, copied from the engine when this page was built; the rule is ported from gitleaks’ default rule set (MIT licence; version, skipped rules and changes). Detectors run in a fixed order and, where two overlap, the earlier one wins.
Example (fake)
# EXAMPLE .npmrc line, not a real token
//registry.npmjs.org/:_authToken=npm_EXAMPLE0123456789abcdefghijklmnopqrs
nullcipher replaces it with [NPM_ACCESS_TOKEN_1]. The 36 characters after npm_ are EXAMPLE plus a counting run. npm never issued it.
Why it matters in an AI chat
An npm token with publish rights lets its holder publish a new version of every package you maintain. That is how several npm supply-chain attacks started: one stolen token, one malicious release, thousands of installs before anyone noticed.
Tokens sit in .npmrc files and CI variables, and both end up in AI chats when an install or publish step fails with a 401 or 403 and the log is pasted in whole.
npm notes that a revoked token can take up to an hour to stop working, so revoke first and then deal with anything else.
If it already leaked
- On the website: click your profile picture → Access Tokens, find the token and delete it (or select several and click Delete Selected Tokens). [1]
- From the command line: run npm token list, copy the token's ID (not the truncated token), then npm token delete <id>. Run npm token list again to confirm it is gone. [1]
- Check your packages' recent versions on the registry for any release you did not publish, and create a replacement token scoped to only the packages and permissions the job needs. [2]
Sources
- Revoking access tokens — npm Docs — checked 2026-09-25.
- About access tokens — npm Docs — checked 2026-09-25.
Open the full masking tool to mask a whole log, .env file or e-mail — every type at once — and restore the values in the AI's answer. Or see all 229 detectors, with a page for 46 secret types, and how to delete a chat you already sent.