File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ import (
17
17
"golang.org/x/sys/unix"
18
18
"golang.org/x/xerrors"
19
19
"kernel.org/pub/linux/libs/security/libcap/cap"
20
+
21
+ "github.com/coder/coder/v2/agent/usershell"
20
22
)
21
23
22
24
// CLI runs the agent-exec command. It should only be called by the cli package.
@@ -114,7 +116,8 @@ func CLI() error {
114
116
115
117
// Remove environment variables specific to the agentexec command. This is
116
118
// especially important for environments that are attempting to develop Coder in Coder.
117
- env := os .Environ ()
119
+ ei := usershell.SystemEnvInfo {}
120
+ env := ei .Environ ()
118
121
env = slices .DeleteFunc (env , func (e string ) bool {
119
122
return strings .HasPrefix (e , EnvProcPrioMgmt ) ||
120
123
strings .HasPrefix (e , EnvProcOOMScore ) ||
Original file line number Diff line number Diff line change @@ -50,7 +50,17 @@ func (SystemEnvInfo) User() (*user.User, error) {
50
50
}
51
51
52
52
func (SystemEnvInfo ) Environ () []string {
53
- return os .Environ ()
53
+ var env []string
54
+ for _ , e := range os .Environ () {
55
+ // Ignore GOTRACEBACK=none, as it disables stack traces, it can
56
+ // be set on the agent due to changes in capabilities.
57
+ // https://pkg.go.dev/runtime#hdr-Security.
58
+ if e == "GOTRACEBACK=none" {
59
+ continue
60
+ }
61
+ env = append (env , e )
62
+ }
63
+ return env
54
64
}
55
65
56
66
func (SystemEnvInfo ) HomeDir () (string , error ) {
You can’t perform that action at this time.
0 commit comments