Repository navigation
fix(security): the subprocess environment guard refuses the zsh and interpreter keys that make a child run code - #2510
Merged
Conversation
… make a child run code Plans #2429 as the change 2429-refuse-interpreter-code-env-keys.
…ads code is refused The refused keys of the test add the zsh, Python, Node.js, Perl, Ruby and Java keys that make a child load or run code. PYTHONUNBUFFERED, PYTHONDONTWRITEBYTECODE and NODE_ENV load no code and reach the child.
…run code build_subprocess_env refuses a caller override of the zsh, Python, Node.js, Perl, Ruby and Java keys that make a child load or run code. It raises the same SecurityError as for the loader and bash keys, with isolation on and off. The comment of CONST_CODE_LOADING_ENV_PATTERNS names the manual page of each family, and the sudo env_delete list.
…nment of the person With each refused key in the environment, in upper and lower case, the isolated child environment holds none of them. The test fails while DEFAULT_ALLOWED_ENV_VARS holds PYTHONPATH and PYTHONHOME.
…m the environment DEFAULT_ALLOWED_ENV_VARS no longer holds PYTHONPATH and PYTHONHOME. Thus no key of the environment that the guard refuses from a caller reaches an isolated child, and a Python child does not import a sitecustomize module from a directory of the person. A person who wants the value in a child sets isolate_env=False, or the caller names the key in extra_allowed_keys.
…h and interpreter keys The bullet of ARCHITECTURE.md and the purpose of the subprocess-environment spec say that the guard refuses the keys of bash, zsh, Python, Node.js, Perl, Ruby and Java that load or run code, and that an isolated child gets none of them from the environment. The bullet names the git keys that still reach a child (#2483).
…d the comment rule The Feasibility section names the base 08d70ca, the installed manual pages of each key, and the upstream sources of the Java keys: the JVM TI specification and the HotSpot arguments.cpp. The design records how the comment of CONST_CODE_LOADING_ENV_PATTERNS keeps the 25-word rule of #2433.
…ACHE or NODE_REPL_EXTERNAL_MODULE is refused PYTHONPLATLIBDIR moves the standard library of a Python child to the named directory. NODE_COMPILE_CACHE makes a Node.js child run the cached code of a module in place of the source. NODE_REPL_EXTERNAL_MODULE makes the REPL of node load the named module.
…EPL_EXTERNAL_MODULE from a caller python(1) and node(1) list these keys. Each one makes the interpreter of the child load or run code from a place that the caller chooses, as PYTHONHOME, PYTHONPYCACHEPREFIX and PYTHONSTARTUP do.
…L_EXTERNAL_MODULE, HOME and the library keys in the design The design refuses the three interpreter keys and gives the probes. It names HOME as an accepted key that runs code, with the reason. It names the OpenSSL and other library keys as a non-goal with the follow-up issue #2503.
The subprocess-environment spec takes the refused zsh and interpreter keys and the requirement that an isolated child gets no refused key from the environment. The refused-override requirement names the key families, and its scenarios name each key, so that the requirement text stays below the 500-character limit of strict validation.
Owner
Author
|
Test results of the branch at Targeted tests: Fail-to-pass:
The 130 other tests of Fail-to-pass output (the tests that fail on the base) |
dan-petty
marked this pull request as ready for review
October 28, 2026 19:21
dan-petty
pushed a commit
that referenced
this pull request
Oct 28, 2026
🤖 I have created a release *beep* *boop* --- ## [0.11.0](v0.10.1...v0.11.0) (2026-10-28) ### Features * **monitoring:** the roadmap Service's identity refusals, failing and stalled jobs, restarts, and GitHub and model request volume raise alerts ([#2496](#2496)) ([0137f23](0137f23)), closes [#2472](#2472) * **service:** roadmap-service runs at one replica, and each model call in the cluster is sent at most two times ([#2500](#2500)) ([2d32dae](2d32dae)), closes [#2494](#2494) ### Bug Fixes * **cli:** every command reports a DevOpsCLIError through one exit seam ([#2502](#2502)) ([eadd55f](eadd55f)), closes [#2487](#2487) * **github:** pr monitor waits until the checks settle and names every blocker, and pr ready reads the merge-readiness verdict ([#2498](#2498)) ([43326ea](43326ea)) * **k8s:** a pod that does not call the Kubernetes API mounts no service account token ([#2522](#2522)) ([305d3ba](305d3ba)) * **k8s:** the cloudflared tunnel replicas prefer different nodes and keep one up through a drain ([#2499](#2499)) ([d4edaf6](d4edaf6)), closes [#1023](#1023) * **k8s:** the grafana, prometheus, argo cd and loki clients dial through the egress-checked factory, and their pre-flight address checks go ([#2497](#2497)) ([e7ca1d5](e7ca1d5)) * **monitoring:** the roadmap Service alerts count a series that starts in the hour, and a lane of a new pod can stall ([#2514](#2514)) ([c7692b2](c7692b2)), closes [#2505](#2505) * **review:** a review's scanners leave out the rules that never gave a valid finding here ([#2508](#2508)) ([fe953ac](fe953ac)) * **roadmap:** a refine round leaves an outside account issue to a person, and refine neutralizes comment openers, www links and cross-repository references ([#2507](#2507)) ([e6230dc](e6230dc)), closes [#2478](#2478) * **sandbox:** the metrics scrape and the whitelist NetworkPolicy resolve each host one time, through the egress check ([#2521](#2521)) ([7c01426](7c01426)) * **security:** the subprocess environment guard refuses the zsh and interpreter keys that make a child run code ([#2510](#2510)) ([459621a](459621a)) * **service:** a restart keeps the halt, the budget window and the failure ledger, and a rate limit or a suspended installation stops every worker ([#2515](#2515)) ([3630de1](3630de1)), closes [#2474](#2474) ### Code Refactoring * **config:** settings resolve in one declared order through pydantic-settings sources ([#2518](#2518)) ([6a5447a](6a5447a)), closes [#2445](#2445) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The subprocess environment guard accepted the zsh and interpreter keys that make a child load or run code that its caller did not choose. With
ZDOTDIR,PYTHONPATH,NODE_OPTIONS,PERL5OPTorRUBYOPTin the override of a caller, the child ran a file or a module from a directory that the caller chose. An isolated child also got thePYTHONPATHandPYTHONHOMEof the person, so a Python child, for example Semgrep or mypy, imported asitecustomizemodule from that directory.CONST_CODE_LOADING_ENV_PATTERNSadds the zsh keys (ZDOTDIR,FPATH,NULLCMD,READNULLCMD), the Python keys (PYTHONPATH,PYTHONHOME,PYTHONSTARTUP,PYTHONUSERBASE,PYTHONPLATLIBDIR,PYTHONPYCACHEPREFIX), the Node.js keys (NODE_OPTIONS,NODE_PATH,NODE_COMPILE_CACHE,NODE_REPL_EXTERNAL_MODULE), the Perl keys (PERL5OPT,PERL5LIB,PERLLIB,PERL5DB), the Ruby keys (RUBYOPT,RUBYLIB) and the Java keys (JAVA_TOOL_OPTIONS,JDK_JAVA_OPTIONS,_JAVA_OPTIONS,CLASSPATH). The keys come from the defaultenv_deletetable of sudo and from the manual page of each shell and interpreter. A comment above each family names its source.build_subprocess_envrefuses a caller override of each of these keys, in upper or lower case, with isolation on and off. It raises the sameSecurityErroras for the loader and bash keys.DEFAULT_ALLOWED_ENV_VARSremovesPYTHONPATHandPYTHONHOME. Thus an isolated child gets no refused key from the environment, unless the caller names the key inextra_allowed_keys.PYTHONUNBUFFERED,PYTHONDONTWRITEBYTECODEandNODE_ENVload no code, and they still reach the child.ARCHITECTURE.mdnames the refused families. It also names the keys that make a child run code and still reach it:HOME, the git keys (fix(security): the subprocess environment guard accepts the git keys that make a git child run a program #2483) and the library keys, for exampleOPENSSL_CONF(fix(security): the subprocess environment guard accepts the library keys that make a child load a module, for example OPENSSL_CONF #2503).subprocess-environmentspec adds the new keys and the requirement that an isolated child gets no refused key from the environment.Closes #2429
Change:
openspec/changes/archive/2026-10-28-2429-refuse-interpreter-code-env-keys/