|
| 1 | +From bccdae45d85882dc2fb2fafa80b8b2997f561fe3 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Scott Moser < [email protected]> |
| 3 | +Date: Wed, 13 Nov 2024 14:01:30 -0500 |
| 4 | +Subject: [PATCH] Change default telemetry setting from 'local' to 'off' |
| 5 | + |
| 6 | +Go 1.23 introduced a telemetry feature that collects local audit data |
| 7 | +about the Go toolchain, storing it by default in |
| 8 | +$HOME/.config/go/telemetry. While this data is not sent externally by |
| 9 | +default, the local storage path can trigger security alerts in tools |
| 10 | +like Falco, as it writes to a sensitive location under /root. |
| 11 | + |
| 12 | +The behavior can be disabled with 'go telemetry off', which writes |
| 13 | +to the config file above, but that means the user needs to do so |
| 14 | +before calling 'go' in any other manner. Doing so for a container |
| 15 | +is non-obvious. We could build /root/.config/go/telemetry into |
| 16 | +a 'go' image, but that would still provide a problem for any user |
| 17 | +other than uid 0. |
| 18 | + |
| 19 | +There is no mechanism to change the behavior "system wide" or an |
| 20 | +environment variable that can set the value. |
| 21 | + |
| 22 | +See https://github.com/golang/go/issues/68960 and |
| 23 | +https://github.com/golang/go/issues/69113. The second one requests that |
| 24 | +env GOTELEMETRY=off would disable telemetry. That would be easy for us |
| 25 | +to utilize but it was rejected upstream. |
| 26 | + |
| 27 | +Instead, we just change the default value returned if there is no |
| 28 | +.config/go/telemetry/mode file present. |
| 29 | +--- |
| 30 | + src/cmd/vendor/golang.org/x/telemetry/internal/telemetry/dir.go | 2 +- |
| 31 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
| 32 | + |
| 33 | +diff --git a/src/cmd/vendor/golang.org/x/telemetry/internal/telemetry/dir.go b/src/cmd/vendor/golang.org/x/telemetry/internal/telemetry/dir.go |
| 34 | +index dd7a63c816..cc4d08f651 100644 |
| 35 | +--- a/src/cmd/vendor/golang.org/x/telemetry/internal/telemetry/dir.go |
| 36 | ++++ b/src/cmd/vendor/golang.org/x/telemetry/internal/telemetry/dir.go |
| 37 | +@@ -127,7 +127,7 @@ func (d Dir) Mode() (string, time.Time) { |
| 38 | + } |
| 39 | + data, err := os.ReadFile(d.modefile) |
| 40 | + if err != nil { |
| 41 | +- return "local", time.Time{} // default |
| 42 | ++ return "off", time.Time{} // default |
| 43 | + } |
| 44 | + mode := string(data) |
| 45 | + mode = strings.TrimSpace(mode) |
| 46 | +-- |
| 47 | +2.43.0 |
| 48 | + |
0 commit comments