fix(telemetry): make telemetry opt-in and anonymize install ID - #61
Merged
Conversation
Patel230
force-pushed
the
fix/telemetry-privacy-optin
branch
from
August 3, 2026 00:30
bf4654a to
4d823f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Phase 3 medium audit finding (C5): the CLI's detached telemetry:
machineid.ProtectedID("trace-cli")) as the PostHogdistinct_id, so events could be correlated to a physical machine across installs.TRACE_TELEMETRY_OPTOUT) — telemetry was ON by default for every user.Fix
anonymousID(): a random 128-bit value generated on first use and cached atos.UserConfigDir()/trace/telemetry-id(dir 0700, file 0600). Stable per install, not correlated to hardware.TRACE_TELEMETRY_OPTIN=1is set. The legacyTRACE_TELEMETRY_OPTOUTstill force-disables regardless.sendDetacheddispatch var so tests can assert dispatch behavior without spawning subprocesses.userConfigDiris now a var so tests isolate the ID file from the real user config dir (relevant on macOS whereXDG_CONFIG_HOMEis ignored).github.com/denisbrodbeck/machineiddependency.Tests
TestTrackCommandDetachedRespectsOptOut— opt-out wins over opt-inTestTrackCommandDetachedDisabledByDefault— no opt-in ⇒ no dispatchTestTrackCommandDetachedEnabledWithOptIn— opt-in ⇒ exactly 1 dispatchTestTrackPluginDetachedDisabledByDefault/TestTrackPluginDetachedEnabledWithOptInVerified:
go build ./...,go vet ./...,go test ./...all green.