Skip to content

Security: NPM auth token is passed on command line (process list exposure)#1206

Open
tomaioo wants to merge 1 commit intomicrosoft:mainfrom
tomaioo:fix/security/npm-auth-token-is-passed-on-command-line
Open

Security: NPM auth token is passed on command line (process list exposure)#1206
tomaioo wants to merge 1 commit intomicrosoft:mainfrom
tomaioo:fix/security/npm-auth-token-is-passed-on-command-line

Conversation

@tomaioo
Copy link
Copy Markdown

@tomaioo tomaioo commented Apr 18, 2026

Summary

Security: NPM auth token is passed on command line (process list exposure)

Problem

Severity: High | File: packages/beachball/src/packageManager/npmArgs.ts:L20

Publish arguments include auth credentials directly as CLI flags (for example --//registry/:_authToken=<token>). Command-line arguments can be exposed via process listings, CI diagnostics, crash reports, or audit tooling, leading to credential leakage.

Solution

Do not pass tokens in CLI args. Prefer environment variables supported by npm (NODE_AUTH_TOKEN) or write a temporary .npmrc with restrictive permissions and delete it after use. Ensure logs never print full auth material.

Changes

  • packages/beachball/src/packageManager/npmArgs.ts (modified)

Publish arguments include auth credentials directly as CLI flags (for example `--//registry/:_authToken=<token>`). Command-line arguments can be exposed via process listings, CI diagnostics, crash reports, or audit tooling, leading to credential leakage.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
Copy link
Copy Markdown
Member

@ecraig12345 ecraig12345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something that could potentially be handled better, but npm itself doesn't support NODE_AUTH_TOKEN--best I can tell it's specific to actions/setup-node, and if you follow those instructions you could already pass the token that way without modifying beachball.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants