Repository navigation
Make every opt-out fail closed (0.4.0) - #40
Merged
Merged
Conversation
A switch that does not clearly mean "on" now turns reporting off, so an opt-out can never be read as consent: - Environment: TRACE_USAGE_REPORTING set to anything but blank or a clear "on" (true/on/yes/1) disables; DO_NOT_TRACK set to anything but blank or a clear "no" (0/false/off/no) disables. Before, only a fixed list of values disabled, so TRACE_USAGE_REPORTING=disabled or DO_NOT_TRACK=on left reporting on. - An environment that cannot be read (e.g. a SecurityException in a sandbox) now disables; it used to leave reporting on. - New TraceClient.AllowsReporting(object) for a program's own setting: only true, or a string true/on/yes/1, allows reporting; anything else, including null, a number or a quoted "false", turns it off. The README and doc-comment examples now pass the setting through it. Counterpart of Stephenson-Software/trace-client-java#51. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 19, 2026
3 tasks
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.
Usage reporting must actually stay off when it is turned off. This brings the C# client to the same fail-closed semantics as the Java client 0.8.0 (Stephenson-Software/trace-client-java#51).
Fail-open paths fixed
TRACE_USAGE_REPORTINGwas a deny-list (off/false/0/no): any other non-blank value, e.g.disabledor a typo, left reporting on. It now disables for anything but blank ortrue/on/yes/1(case-insensitive, trimmed).DO_NOT_TRACKwas an allow-list of opt-outs (1/true/yes):on,yand so on left reporting on. It now disables for anything but blank or0/false/off/no.SecurityExceptionin a sandbox) was treated as "not opted out".EnvironmentDisables()now returnstruein that case, and the constructor reports reasonenvironment; it still never throws.TraceClient.AllowsReporting(object):true, or a stringtrue/on/yes/1(any case, trimmed), allows reporting;null,false, a quoted"false", a typo or a number turns it off. The README examples and the class doc comment now use it.The client reads no config file of its own with a switch (the install-ID file holds only an ID), so no file-parsing changes were needed.
Version
0.3.0 → 0.4.0 in the file header,
TraceClient.Version, the csproj<Version>and the README User-Agent example.Tests
dotnet test -c Release(net8.0): 162 passed, 0 failed. Tests that pinned fail-open behaviour were updated (EnvironmentDisables_IsTrueWhenTheEnvironmentCannotBeRead, the "leave the program setting in charge" set now only blank or clearly-on values); new cases cover typos in both variables andAllowsReportingfor bool, string, null and numbers. The .NET Framework 4.8 leg runs in CI only.🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson