Skip to content

fix(shim-wasm): set the OCI env for Linux containers in setup_envs - #1183

Open
mani-svs wants to merge 1 commit into
containerd:mainfrom
mani-svs:fix/native-container-envs
Open

mani-svs wants to merge 1 commit into
containerd:mainfrom
mani-svs:fix/native-container-envs

Conversation

@mani-svs

@mani-svs mani-svs commented Oct 9, 2026

Copy link
Copy Markdown

Executor::setup_envs was a no-op for every container type. That is right for Wasm containers, where the shim passes the env into the WASI context, but a Linux (native) container has no such code, so it ran with the shim's own environment (including its PATH) instead of the one from its OCI spec. This breaks, for example, Knative's queue-proxy sidecar in a Wasm pod.

Delegate to libcontainer's default setup_envs when the container type is Linux. libcontainer calls validate right before setup_envs, so the type cached by validate is available; if it is not, return an error instead of guessing. Wasm containers are unchanged.

Adds unit tests, including one that runs busybox env through the same validate / setup_envs / exec sequence and checks it sees only its own env.

Fixes #1061

Assisted-by: Claude Code (claude-sonnet-5-5)

`Executor::setup_envs` was a no-op for every container type. That is right
for Wasm containers, where the shim passes the env into the WASI context, but
a Linux (native) container has no such code, so it ran with the shim's own
environment (including its PATH) instead of the one from its OCI spec. This
breaks, for example, Knative's queue-proxy sidecar in a Wasm pod.

Delegate to libcontainer's default `setup_envs` when the container type is
Linux. libcontainer calls `validate` right before `setup_envs`, so the type
cached by `validate` is available; if it is not, return an error instead of
guessing. Wasm containers are unchanged.

Adds unit tests, including one that runs busybox `env` through the same
validate / setup_envs / exec sequence and checks it sees only its own env.

Fixes containerd#1061

Assisted-by: Claude Code (claude-sonnet-5-5)
Signed-off-by: Venkatasubramanian Srinivasan <mani.svs@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Env of native containers is not being set

1 participant