Problem
The telemetryDisablerTransport in api/http_client.go:165-170 checks every outgoing HTTP request with ghauth.IsEnterprise(host). If the host is not github.com, it calls telemetryDisabler.Disable(), which permanently disables telemetry for the entire CLI invocation.
func (t telemetryDisablerTransport) RoundTrip(req *http.Request) (*http.Response, error) {
if ghauth.IsEnterprise(getHost(req)) {
t.telemetryDisabler.Disable()
}
return t.wrappedTransport.RoundTrip(req)
}
Several commands make legitimate HTTP requests to non-GitHub hosts through the factory HTTP client, triggering this check incorrectly.
Affected commands
| Command |
Non-GitHub Host |
How |
gh cs ports forward/list/visibility |
global.rel.tunnels.api.visualstudio.com |
Dev-tunnels API for port management |
gh cs ssh |
global.rel.tunnels.api.visualstudio.com |
Dev-tunnels API for SSH tunnel |
gh cs logs |
global.rel.tunnels.api.visualstudio.com |
Dev-tunnels API for log streaming |
gh cs jupyter |
global.rel.tunnels.api.visualstudio.com |
Dev-tunnels API for Jupyter forwarding |
gh cs rebuild |
global.rel.tunnels.api.visualstudio.com |
Dev-tunnels API for rebuild connection |
gh api <full-url> |
Any host |
User can pass arbitrary URLs |
gh attestation download/verify/inspect |
Bundle URLs |
Fetches attestation bundles directly |
gh extension install/upgrade |
Release asset URLs |
Downloads from asset.APIURL |
How to reproduce
GH_TELEMETRY=log gh cs ports forward 3000:3000
# ctrl+c after ports are forwarded (requires signal handler fix from #13401)
# Output: "Telemetry payload: none"
Impact
All codespace tunnel commands produce zero telemetry even for github.com users. The gh api command also loses telemetry whenever a user passes a full non-GitHub URL.
Possible fixes
- Allowlist known non-GitHub hosts - skip the enterprise check for known hosts like
visualstudio.com
- Only check on GitHub API requests - only run the enterprise check when the request is to a host that looks like a GitHub API endpoint
- Check the configured host instead of request host - the intent is to detect GHES users, which is already done by
mightBeGHESUser() at startup. The transport-level check could be removed or narrowed to only trigger on hosts that match the configured GH_HOST or auth hosts
References
api/http_client.go:160-170 - telemetryDisablerTransport
internal/ghcmd/cmd.go:88 - mightBeGHESUser() (startup check)
internal/ghcmd/cmd.go:103-104 - telemetryService.Disable() (startup disable)
Problem
The
telemetryDisablerTransportinapi/http_client.go:165-170checks every outgoing HTTP request withghauth.IsEnterprise(host). If the host is notgithub.com, it callstelemetryDisabler.Disable(), which permanently disables telemetry for the entire CLI invocation.Several commands make legitimate HTTP requests to non-GitHub hosts through the factory HTTP client, triggering this check incorrectly.
Affected commands
gh cs ports forward/list/visibilityglobal.rel.tunnels.api.visualstudio.comgh cs sshglobal.rel.tunnels.api.visualstudio.comgh cs logsglobal.rel.tunnels.api.visualstudio.comgh cs jupyterglobal.rel.tunnels.api.visualstudio.comgh cs rebuildglobal.rel.tunnels.api.visualstudio.comgh api <full-url>gh attestation download/verify/inspectgh extension install/upgradeasset.APIURLHow to reproduce
Impact
All codespace tunnel commands produce zero telemetry even for
github.comusers. Thegh apicommand also loses telemetry whenever a user passes a full non-GitHub URL.Possible fixes
visualstudio.commightBeGHESUser()at startup. The transport-level check could be removed or narrowed to only trigger on hosts that match the configuredGH_HOSTor auth hostsReferences
api/http_client.go:160-170-telemetryDisablerTransportinternal/ghcmd/cmd.go:88-mightBeGHESUser()(startup check)internal/ghcmd/cmd.go:103-104-telemetryService.Disable()(startup disable)