Skip to content

Commit

Permalink
Merge pull request #20425 from giuseppe/podman-do-not-leak-DBUS_SESSI…
Browse files Browse the repository at this point in the history
…ON_BUS_ADDRESS-into-conmon

libpod: skip DBUS_SESSION_BUS_ADDRESS in conmon
  • Loading branch information
openshift-ci[bot] authored Oct 21, 2023
2 parents 3661c87 + 03947ab commit 19c870d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions libpod/oci_conmon_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,11 @@ func (r *ConmonOCIRuntime) configureConmonEnv() ([]string, error) {
// The NOTIFY_SOCKET must not leak into the environment.
continue
}
if strings.HasPrefix(v, "DBUS_SESSION_BUS_ADDRESS=") && !rootless.IsRootless() {
// The DBUS_SESSION_BUS_ADDRESS must not leak into the environment when running as root.
// This is because we want to use the system session for root containers, not the user session.
continue
}
res = append(res, v)
}
runtimeDir, err := util.GetRuntimeDir()
Expand Down
7 changes: 6 additions & 1 deletion test/system/030-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,12 @@ search | $IMAGE |
run_podman container inspect $cid --format "{{ .State.ConmonPid }}"
conmon_pid="$output"
is "$(< /proc/$conmon_pid/cmdline)" ".*--exit-command-arg--syslog.*" "conmon's exit-command has --syslog set"
assert "$(< /proc/$conmon_pid/environ)" =~ "BATS_TEST_TMPDIR" "entire env is passed down to conmon (incl. BATS variables)"
conmon_env="$(< /proc/$conmon_pid/environ)"
assert "$conmon_env" =~ "BATS_TEST_TMPDIR" "entire env is passed down to conmon (incl. BATS variables)"
assert "$conmon_env" !~ "NOTIFY_SOCKET=" "NOTIFY_SOCKET is not included (incl. BATS variables)"
if ! is_rootless; then
assert "$conmon_env" !~ "DBUS_SESSION_BUS_ADDRESS=" "DBUS_SESSION_BUS_ADDRESS is not included (incl. BATS variables)"
fi

run_podman rm -f -t0 $cid
}
Expand Down

0 comments on commit 19c870d

Please sign in to comment.