diff --git a/act/container/docker_run.go b/act/container/docker_run.go index 04ea67dd..50997cf9 100644 --- a/act/container/docker_run.go +++ b/act/container/docker_run.go @@ -1117,6 +1117,10 @@ func sanitizeOptionsHostConfig(logger logrus.FieldLogger, hostConfig, trusted *c // systempaths=unconfined lands in these two rather than in SecurityOpt resetOption(logger, "--security-opt", &hostConfig.MaskedPaths, trusted.MaskedPaths) resetOption(logger, "--security-opt", &hostConfig.ReadonlyPaths, trusted.ReadonlyPaths) + resetOption(logger, "--log-driver", &hostConfig.LogConfig.Type, trusted.LogConfig.Type) // drivers run in the daemon, egressing from its network + resetOption(logger, "--log-opt", &hostConfig.LogConfig.Config, trusted.LogConfig.Config) + resetOption(logger, "--oom-score-adj", &hostConfig.OomScoreAdj, trusted.OomScoreAdj) // -1000 exempts it from the host OOM killer + resetOption(logger, "--oom-kill-disable", &hostConfig.OomKillDisable, trusted.OomKillDisable) // a driver mounts what it likes, e.g. local with device= binds any host path, which // valid_volumes never gets to see diff --git a/act/container/docker_run_test.go b/act/container/docker_run_test.go index 70c40ed0..249141d5 100644 --- a/act/container/docker_run_test.go +++ b/act/container/docker_run_test.go @@ -666,6 +666,9 @@ func TestSanitizeOptionsHostConfig(t *testing.T) { DeviceCgroupRules: []string{"a *:* rwm"}, DeviceRequests: []container.DeviceRequest{{Count: -1, Capabilities: [][]string{{"gpu"}}}}, Sysctls: map[string]string{"net.ipv4.ip_forward": "1"}, + LogConfig: container.LogConfig{Type: "syslog", Config: map[string]string{"syslog-address": "tcp://169.254.169.254:514"}}, + OomScoreAdj: -1000, + OomKillDisable: new(true), } sanitizeOptionsHostConfig(logger, hostConfig, &container.HostConfig{}) @@ -699,7 +702,9 @@ func TestMergeContainerConfigsStripsDangerousOptionsWhenUnprivileged(t *testing. const dangerousOptions = "--pid=host --ipc=host --uts=host --cgroupns=host " + "--userns=host --cap-add=ALL --security-opt seccomp=unconfined " + "--security-opt apparmor=unconfined --volumes-from other --isolation process " + - "--runtime runc --cgroup-parent /custom --sysctl net.ipv4.ip_forward=1" + "--runtime runc --cgroup-parent /custom --sysctl net.ipv4.ip_forward=1 " + + "--log-driver=syslog --log-opt syslog-address=tcp://169.254.169.254:514 " + + "--oom-score-adj=-1000 --oom-kill-disable" // whatever the workflow adds, an unprivileged container comes out exactly as the runner's // own options alone describe it, field for field