Repository navigation
Description
Problem Description
build_subprocess_env in src/devops_cli/core/process.py refuses a caller override that CONST_CODE_LOADING_ENV_PATTERNS matches: the loader keys of glibc and macOS, GCONV_PATH, the bash and zsh keys, and the interpreter keys of #2429. It accepts the keys that make a shared library in the child load a module from a place that the caller chooses:
OPENSSL_CONF: OpenSSL reads this configuration file when it starts in the child. The file can name a provider or an engine module, which is a shared library. Each program that uses OpenSSL reads the key, for examplenode,curl, thesslmodule of Python and git over HTTPS.node(1)lists the key.OPENSSL_CONF_INCLUDE,OPENSSL_MODULESandOPENSSL_ENGINES: the directory of the included configuration files, of the provider modules and of the dynamic engines.openssl-env(7)callsOPENSSL_CONF,OPENSSL_CONF_INCLUDEandOPENSSL_ENGINESsecurity-sensitive.- Other libraries have keys of the same kind. For example, the
env_deletetable of sudo removesKRB5_CONFIG*when sudo has Kerberos support, and a Kerberos configuration file can name plug-in modules.
The design of #2429 records these keys as a non-goal, because #2429 asks only for the shell and interpreter keys. A library key has an effect in each program that links the library, not in one interpreter. Thus the fix must find the libraries that devops-cli children use and the keys of each library that load a module.
Reproduction Steps
- Run
uv run python -c 'from devops_cli.core.process import build_subprocess_env as b; print(sorted(b(env={"OPENSSL_CONF": "x", "OPENSSL_MODULES": "x", "OPENSSL_ENGINES": "x"})))'. - In a temporary directory
<dir>, compilep.sofrom a C file with a constructor that writes a marker to the standard output (gcc -shared -fPIC -o <dir>/p.so p.c). - In
<dir>, writeo.cnfwithopenssl_conf = c,nodejs_conf = c, a section[c]withproviders = p, a section[p]withx = px, and a section[px]withmodule = <dir>/p.soandactivate = 1. - Run
env -i PATH=<node dir>:/usr/bin:/bin OPENSSL_CONF=<dir>/o.cnf node -e 0. Then run the same environment withcurl --versionand withpython3 -c 'import ssl; ssl.create_default_context()'.
Expected vs Actual Behavior
Expected: build_subprocess_env raises SecurityError for a caller override that makes a library of the child load a module from a place that the caller chooses, or the design of the guard names each such key that it accepts and the reason.
Actual: step 1 returns the three keys with no SecurityError. Each command of step 4 prints the marker, so the child runs code from <dir> before the requested command.
Environment Diagnostics
- DevOps CLI Version: branch of fix(security): the subprocess environment guard refuses the zsh and interpreter keys that make a child run code #2429, from main at daaffc6
- Python Version: 3.14.9 (/usr/bin/python3) and 3.14.10 (uv)
- OS & Architecture: Linux x86_64 (WSL2)
- Execution Environment: DevContainer
Logs, Traces, or Terminal Output
$ env -i PATH=<node dir>:/usr/bin:/bin OPENSSL_CONF=<dir>/o.cnf node -e 0 # node v24.22.1, OpenSSL 3.5.9
OPENSSL-CONF-MODULE-RAN
$ env -i PATH=/usr/bin:/bin OPENSSL_CONF=<dir>/o.cnf curl --version # OpenSSL 3.6.5
OPENSSL-CONF-MODULE-RAN
$ env -i PATH=/usr/bin:/bin OPENSSL_CONF=<dir>/o.cnf python3 -c 'import ssl; ssl.create_default_context()'
OPENSSL-CONF-MODULE-RANThe adversary review of the change of #2429 found the OPENSSL_CONF case. With isolate_env=True, no allowed key or prefix of DEFAULT_ALLOWED_ENV_VARS or DEFAULT_ALLOWED_ENV_PREFIXES lets an ambient OpenSSL key reach an isolated child. Thus the defect is the caller override only.
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Source: #2429
Proposed design
Problem statement
The subprocess environment guard in build_subprocess_env accepts caller overrides for library-level code-loading keys such as OPENSSL_CONF. A caller can set these keys to make a shared library in the child process load a module from an attacker-chosen path. The child runs attacker code before the requested command. The guard currently refuses only loader, shell, and interpreter keys. It does not refuse the keys that make a linked library load a module.
Acceptance criteria
- Criterion 1: build_subprocess_env raises SecurityError when a caller override sets OPENSSL_CONF.
Verification: Run: uv run python -c 'from devops_cli.core.process import build_subprocess_env as b; b(env={"OPENSSL_CONF": "x"})' and confirm it raises SecurityError. - Criterion 2: build_subprocess_env raises SecurityError when a caller override sets OPENSSL_CONF_INCLUDE.
Verification: Run: uv run python -c 'from devops_cli.core.process import build_subprocess_env as b; b(env={"OPENSSL_CONF_INCLUDE": "x"})' and confirm it raises SecurityError. - Criterion 3: build_subprocess_env raises SecurityError when a caller override sets OPENSSL_MODULES.
Verification: Run: uv run python -c 'from devops_cli.core.process import build_subprocess_env as b; b(env={"OPENSSL_MODULES": "x"})' and confirm it raises SecurityError. - Criterion 4: build_subprocess_env raises SecurityError when a caller override sets OPENSSL_ENGINES.
Verification: Run: uv run python -c 'from devops_cli.core.process import build_subprocess_env as b; b(env={"OPENSSL_ENGINES": "x"})' and confirm it raises SecurityError. - Criterion 5: build_subprocess_env raises SecurityError when a caller override sets KRB5_CONFIG.
Verification: Run: uv run python -c 'from devops_cli.core.process import build_subprocess_env as b; b(env={"KRB5_CONFIG": "x"})' and confirm it raises SecurityError. - Criterion 6: The constant comment names the source manual page for each new key.
Verification: Read the comment above the new entries in src/devops_cli/config/constants.py and confirm each key has its manual page named. - Criterion 7: No key in DEFAULT_ALLOWED_ENV_VARS or DEFAULT_ALLOWED_ENV_PREFIXES matches a new refused pattern.
Verification: Run the existing test suite in tests/test_subprocess_env_boundary.py and confirm all tests pass.
Key questions
- Which environment variable keys make a shared library in a child process load a module from a caller-chosen path?: OPENSSL_CONF, OPENSSL_CONF_INCLUDE, OPENSSL_MODULES, OPENSSL_ENGINES (OpenSSL), and KRB5_CONFIG (Kerberos). The body names these keys and cites openssl-env(7) and the sudo env_delete table as sources. [sources: src/devops_cli/core/process.py, openspec/changes/archive/2026-10-28-2429-refuse-interpreter-code-env-keys/design.md]
- Should the new keys be added as exact names or as fnmatch patterns in CONST_CODE_LOADING_ENV_PATTERNS?: Exact names. The design of fix(security): the subprocess environment guard refuses the zsh and interpreter keys that make a child run code #2429 chose exact names over family patterns to avoid refusing keys that load no code, such as PYTHONUNBUFFERED or NODE_ENV. The same rule applies here: OPENSSL_CONF is one key, not a family. (best practice) [sources: openspec/changes/archive/2026-10-28-2429-refuse-interpreter-code-env-keys/design.md, openspec/changes/archive/2026-10-28-2205-refuse-code-loading-env-keys/design.md]
- Chosen: Exact names (OPENSSL_CONF, OPENSSL_CONF_INCLUDE, OPENSSL_MODULES, OPENSSL_ENGINES, KRB5_CONFIG). The project's established pattern from fix(security): the subprocess environment guard refuses ld_audit, every dyld_ key and exported bash functions #2205 and fix(security): the subprocess environment guard refuses the zsh and interpreter keys that make a child run code #2429 uses exact names. A pattern such as OPENSSL_* would also refuse keys that load no code and that a caller has a reason to set.
- Rejected: fnmatch patterns (OPENSSL_, KRB5_CONFIG). Rejected because the project's design of fix(security): the subprocess environment guard refuses the zsh and interpreter keys that make a child run code #2429 explicitly chose exact names to avoid over-refusal. A wildcard would block keys that are not code-loading.
- Should the fix cover only the OpenSSL keys or also other library keys such as KRB5_CONFIG?: Add the four OpenSSL keys and KRB5_CONFIG. The body names all five and cites their sources. The body says the fix must find the libraries devops-cli children use and the keys of each library that load a module. OpenSSL is linked by node, curl, Python ssl, and git over HTTPS. Kerberos is linked by sudo and other tools. Both are named in the body with their sources. (best practice) [sources: src/devops_cli/core/process.py, ARCHITECTURE.md]
- Chosen: Add the four OpenSSL keys and KRB5_CONFIG. The body names all five keys and cites their sources. Both OpenSSL and Kerberos are libraries that devops-cli children link. Adding both closes the named code-loading paths.
- Rejected: Add only the four OpenSSL keys. Rejected because the body explicitly names KRB5_CONFIG and the sudo env_delete table as evidence of the same kind of key. Leaving it out leaves a known code-loading path open.
- Rejected: Add a broad pattern for all library keys. Rejected because the project's design uses exact names. A broad pattern would refuse keys that do not load code and would be hard to maintain.
- Where in the code should the new keys be added?: In CONST_CODE_LOADING_ENV_PATTERNS in src/devops_cli/config/constants.py. The existing guard in build_subprocess_env already calls _is_env_var_denied with this constant for caller overrides. Adding the keys to the constant is sufficient; no change to process.py is needed. [sources: src/devops_cli/core/process.py, openspec/changes/archive/2026-10-28-2205-refuse-code-loading-env-keys/design.md, openspec/changes/archive/2026-10-28-2429-refuse-interpreter-code-env-keys/design.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The guard accepts environment keys that let a caller load a shared library into a child process, which is a security gap.A caller can make any child that links OpenSSL run attacker-chosen code before the requested command.The fix closes a code-execution path in every subprocess that links a module-loading library.The fix must enumerate the module-loading keys of each library devops-cli children link and add them to the guard.Both target build_subprocess_env in process.py for unblocked code-loading keys, but each names a different set of variables and a different library or tool.fix(security): the subprocess environment guard refuses the zsh and i…
devops-cli-service commentedon Oct 29, 2026
Status set to Ready at d156ce7 (see proposed design in issue body).
fix(security): the guard refuses the ssh keys and SHELL (#2678)
chore(main): release 0.17.0 (#2683)