Skip to content

fix(cli): Opt out of telemetry for any truthy DO_NOT_TRACK or SENTRY_CLI_NO_TELEMETRY - #2932

Open
sentry-junior[bot] wants to merge 4 commits into
mainfrom
fix/cli-telemetry-env-truthy
Open

sentry-junior[bot] wants to merge 4 commits into
mainfrom
fix/cli-telemetry-env-truthy

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

SENTRY_CLI_NO_TELEMETRY and DO_NOT_TRACK only opted out when set to exactly 1. The installers also ignored DO_NOT_TRACK.

Value Before After
1 opts out opts out
true, TRUE, yes, on, any other non-empty value telemetry on opts out
0, false, no, off, f, n (any case), empty no opt-out no opt-out

The CLI now reads both variables with envToBool from @sentry/core, the helper the SDKs use, instead of a new parser. In its default (loose) mode it returns false for empty and false-like values and true for anything else, which is the opt-out rule. Two details come from that helper: f and n also count as false, and values are not trimmed, so " 0 " opts out.

Precedence stays the same: SENTRY_CLI_NO_TELEMETRY, then DO_NOT_TRACK, then sentry cli defaults telemetry, then on by default.

A false-like value such as SENTRY_CLI_NO_TELEMETRY=0 doesn't opt in. It only doesn't opt out, so DO_NOT_TRACK, the saved preference, or the default still decides. Forcing telemetry on from an env var would override a user's explicit sentry cli defaults telemetry off.

The sentry mcp / @sentry/mcp-server stdio server already decides through isTelemetryEnabled(), so it gets the fix with no separate change.

The shell installer (install) and install.ps1 now skip their error reports for the same values of either variable. Each has a small check with the same false-like set (env_flag_set in POSIX case patterns, Test-EnvFlag in PowerShell), since they can't use the CLI's code.

Also updated the env-registry descriptions, the installer help text, the getting-started, configuration and migration docs, and TELEMETRY.md.

via @BYK.

--

View Session [Sentry]

…CLI_NO_TELEMETRY

Both variables opted out only for the exact value `1`, so `DO_NOT_TRACK=true`
still sent telemetry. They now opt out for any value except an empty or
false-like one (`0`, `false`, `no`, `off`), read by a shared `isEnvFlagSet()`
that the wizard's `SENTRY_SPOTLIGHT` check already used inline. A false-like
value doesn't opt in: the next source in the precedence still decides.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@sentry-junior
sentry-junior Bot requested a review from BYK December 5, 2026 08:18
@vercel

vercel Bot commented Dec 5, 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 5, 2026 8:30am UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 5, 2026 8:30am UTC

Request Review

Use `envToBool` from `@sentry/core` for SENTRY_CLI_NO_TELEMETRY and
DO_NOT_TRACK instead of a new `isEnvFlagSet()` helper. In loose mode it
already returns false for empty and false-like values and true for any
other value, which is the opt-out rule. Drops the helper and the wizard
change that came with it.

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

`install` and `install.ps1` skipped their error reports only for
SENTRY_CLI_NO_TELEMETRY=1 and ignored DO_NOT_TRACK. Both now skip them
when either variable holds any value except an empty or false-like one
(0, false, f, n, no, off, any case), the same values the CLI reads.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
`Array#includes` on the recorded URLs read to CodeQL as a URL substring
check. Compare each URL with `===` instead; the test checks the same thing.

This branch was successfully deployed

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

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants