tests: fix rkt command environment (#5011)

The environment variables needed for envoking `rkt` command line
should include host PATH (to access `iptables`).

Given that the command runs outside the VM, untrusted task environment
variables should NOT be honored here.

We do this already with `rkt`, but the change is quite subtle to miss
when refactoring.
This commit is contained in:
Mahmood Ali
2018-12-15 20:25:36 -05:00
committed by GitHub
parent 4a51769250
commit ee652be312

View File

@@ -661,10 +661,13 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *cstru
Args: runArgs,
ResourceLimits: true,
Resources: cfg.Resources,
Env: cfg.EnvList(),
TaskDir: cfg.TaskDir().Dir,
StdoutPath: cfg.StdoutPath,
StderrPath: cfg.StderrPath,
// Use rktEnv, the environment needed for running rkt, not the task env
Env: rktEnv.List(),
TaskDir: cfg.TaskDir().Dir,
StdoutPath: cfg.StdoutPath,
StderrPath: cfg.StderrPath,
}
ps, err := execImpl.Launch(execCmd)
if err != nil {