You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
keep --environ=none/all/safe temporarily as deprecated compatibility options
add repeated --env KEY=VALUE shebang overrides for explicit environment variables
source the default safe PATH from /etc/environment, with a Debian/Ubuntu root PATH fallback
skip /etc/environment PATH lookup when --env PATH=... is explicitly provided
Rationale
exec-suid previously required PATH to be present in /proc/1/environ. That works when PID 1 is the container process, but it breaks in runtimes where PID 1 is platform infrastructure or a minimal init without image ENV values. /etc/environment is a better image-owned source for this value, and a fixed fallback keeps safe mode usable even when that file is absent.
The new --env option intentionally only supports explicit KEY=VALUE assignments. The shebang line is still split on whitespace, so values containing whitespace are intentionally not supported.
The fallback PATH is /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, matching Debian/Ubuntu's root ENV_SUPATH without Ubuntu's snap-specific suffix. Python's os.defpath is narrower (/bin:/usr/bin), and Ubuntu sudo's secure_path adds /snap/bin, so the Debian root path is the better general-purpose default here.
My guess is it won't be so difficult to have some agents migrate the code in the future. I think --environ=none is kind of silly. I know I've seen some agents think they need to use it to be safe, but you really don't: the default is safe.
And --environ=all is of course inherently unsafe and can always lead to problems. Of course, we have challenges that like that and/or accept that limitation. I'm not sure if a custom really dumb exec-suid makes the most sense for those challenges (it would be really easy to write), or maybe if all of them really just want --env PATH=$PATH or something like that, we can add support for that.
ConnorNelson
changed the title
[codex] Replace exec-suid environ modes with env overrides
Replace exec-suid environ modes with env overrides
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--environ=none/all/safetemporarily as deprecated compatibility options--env KEY=VALUEshebang overrides for explicit environment variablesPATHfrom/etc/environment, with a Debian/Ubuntu root PATH fallback/etc/environmentPATH lookup when--env PATH=...is explicitly providedRationale
exec-suidpreviously requiredPATHto be present in/proc/1/environ. That works when PID 1 is the container process, but it breaks in runtimes where PID 1 is platform infrastructure or a minimal init without imageENVvalues./etc/environmentis a better image-owned source for this value, and a fixed fallback keeps safe mode usable even when that file is absent.The new
--envoption intentionally only supports explicitKEY=VALUEassignments. The shebang line is still split on whitespace, so values containing whitespace are intentionally not supported.The fallback PATH is
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, matching Debian/Ubuntu's rootENV_SUPATHwithout Ubuntu's snap-specific suffix. Python'sos.defpathis narrower (/bin:/usr/bin), and Ubuntu sudo'ssecure_pathadds/snap/bin, so the Debian root path is the better general-purpose default here.Validation
docker build -t exec-suid-env-pr /tmp/exec-suid-pr && docker run --rm exec-suid-env-prpasses: 19 testsgit diff --checkNote:
cargo fmt --checkwas not applied because the existing upstream source is not rustfmt-formatted and rustfmt would rewrite unrelated lines.