@@ -12,6 +12,7 @@ import (
1212 "os"
1313 "os/signal"
1414 "runtime"
15+ "strings"
1516 "syscall"
1617
1718 "github.com/ChristopherHX/github-act-runner/actionsdotnetactcompat"
@@ -144,6 +145,13 @@ func (run *RunRunner) RunWithContext(listenerctx context.Context, ctx context.Co
144145 fmt .Printf ("settings.json is corrupted: %v, please reconfigure the runner\n " , err .Error ())
145146 return 1
146147 }
148+ // Clean up our env to not share it with untrusted subprocesses
149+ for _ , kv := range os .Environ () {
150+ if strings .HasPrefix (kv , "ACTIONS_RUNNER_INPUT_" ) {
151+ k , _ , _ := strings .Cut (kv , "=" )
152+ os .Unsetenv (k )
153+ }
154+ }
147155 runner := & actionsrunner.RunRunner {
148156 Once : run .Once ,
149157 Trace : run .Trace ,
@@ -183,7 +191,22 @@ type RunRunnerSvc struct {
183191}
184192
185193func (svc * RunRunnerSvc ) Start (s service.Service ) error {
186- runner := & RunRunner {}
194+ runner := & RunRunner {
195+ JITConfig : os .Getenv ("ACTIONS_RUNNER_INPUT_JITCONFIG" ),
196+ Terminal : true ,
197+ }
198+ if workerArgs , ok := os .LookupEnv ("ACTIONS_RUNNER_INPUT_WORKER_ARGS" ); ok {
199+ runner .WorkerArgs = strings .Split (workerArgs , "," )
200+ }
201+ if once , ok := common .LookupEnvBool ("ACTIONS_RUNNER_INPUT_ONCE" ); ok {
202+ runner .Once = once
203+ }
204+ if trace , ok := common .LookupEnvBool ("ACTIONS_RUNNER_INPUT_TRACE" ); ok {
205+ runner .Trace = trace
206+ }
207+ if terminal , ok := common .LookupEnvBool ("ACTIONS_RUNNER_INPUT_TERMINAL" ); ok {
208+ runner .Terminal = terminal
209+ }
187210
188211 ctx , cancel := context .WithCancel (context .Background ())
189212 listenerctx , cancelListener := context .WithCancel (context .Background ())
0 commit comments