fix(agent): filter out GOTRACEBACK=none (#16924)

With the switch to Go 1.24.1, our dogfood workspaces started setting
`GOTRACEBACK=none` in the environment, resulting in missing stacktraces
for users.

This is due to the capability changes we do when
`USE_CAP_NET_ADMIN=true`.

https://github.com/coder/coder/blob/564b387262e5b768c503e5317242d9ab576395d6/provisionersdk/scripts/bootstrap_linux.sh#L60-L76

This most likely triggers a change in securitybits which sets
`_AT_SECURE` for the process.

https://github.com/golang/go/blob/a1ddbdd3ef8b739aab53f20d6ed0a61c3474cf12/src/runtime/os_linux.go#L297-L327

Which in turn triggers secure mode:

https://github.com/golang/go/blob/a1ddbdd3ef8b739aab53f20d6ed0a61c3474cf12/src/runtime/security_unix.go

This should not affect workspaces as template authors can still set the
environment on the agent resource.

See https://pkg.go.dev/runtime#hdr-Security
This commit is contained in:
Mathias Fredriksson
2025-03-17 11:10:14 +02:00
committed by GitHub
parent f01ee963b2
commit df92df4565
3 changed files with 24 additions and 2 deletions
+9
View File
@@ -43,4 +43,13 @@ func TestGet(t *testing.T) {
require.NotEmpty(t, shell)
})
})
t.Run("Remove GOTRACEBACK=none", func(t *testing.T) {
t.Setenv("GOTRACEBACK", "none")
ei := usershell.SystemEnvInfo{}
env := ei.Environ()
for _, e := range env {
require.NotEqual(t, "GOTRACEBACK=none", e)
}
})
}