Skip to content

fix(cli): Skip a .sentryclirc token that contains a NUL byte - #2654

Merged
BYK merged 1 commit into
mainfrom
fix/cli-skip-nul-rc-token
Dec 1, 2026
Merged

BYK merged 1 commit into
mainfrom
fix/cli-skip-nul-rc-token

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Fixes #1380.

Node truncates process.env values at the first NUL byte. So when a .sentryclirc [auth] token contains a NUL, applySentryCliRcEnvShim would set SENTRY_AUTH_TOKEN to a prefix of the token, and that prefix passes bearer validation.

This change makes the shim warn and skip such a token. It does not set SENTRY_AUTH_TOKEN and does not record the rc file as the token source. The boot shim still doesn't throw, so --help, auth login, and auth logout keep working. Env precedence doesn't change either. Since the warning names the file, the token isn't dropped silently.

This replaces #2653, which kept the full token in a side table next to process.env. A NUL in an rc token only comes from a corrupted file, and the worst case is a 401 from the server that was going to get the full token anyway. That isn't worth adding a second place where auth tokens are stored.

via @BYK.

--

View Session [Sentry]

Node truncates env values at the first NUL, so the shim would send a
prefix of the token. Warn and skip the token instead.

Fixes #1380

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@vercel

vercel Bot commented Dec 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Dec 1, 2026 12:18pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 1, 2026 12:18pm UTC

Request Review

@sentry-junior
sentry-junior Bot marked this pull request as ready for review December 1, 2026 12:32
@sentry-junior
sentry-junior Bot requested a review from BYK December 1, 2026 12:33
@github-actions github-actions Bot added the risk: low PR risk score: low label Dec 1, 2026
@BYK
BYK added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit b1a1f54 Dec 1, 2026
29 checks passed
@BYK
BYK deleted the fix/cli-skip-nul-rc-token branch December 1, 2026 12:43

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cli — 8b464da8 Deployed Dec 1, 2026 by vercel[bot]
Preview – sentry-local — 8b464da8 Deployed Dec 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(auth): preserve rc tokens before process.env can truncate embedded NULs

1 participant