Repository navigation
fix(security): refuse the library keys that load a module - #2682
Merged
Merged
Conversation
…ad a module Plan the change as openspec/changes/2503-refuse-library-code-env-keys and add the failing tests for #2503. A caller override of an OpenSSL or Kerberos key, of GSS_MECH_CONFIG, SASL_PATH, PYTHONEXECUTABLE or __PYVENV_LAUNCHER__ must raise SecurityError. The keys that load no module must reach the child.
… load a module build_subprocess_env refuses each OPENSSL and KRB5 key of a caller, and the keys GSS_MECH_CONFIG, SASL_PATH, PYTHONEXECUTABLE and __PYVENV_LAUNCHER__. Evidence of the probes, with the real programs: - OPENSSL_CONF made node, curl, ssh, openssl and Python load a provider module. OPENSSL_MODULES and OPENSSL_CONF_INCLUDE did so when a configuration named a provider or a relative include. OPENSSL_ENGINES did so for openssl engine. - GSS_MECH_CONFIG made curl --negotiate and git-remote-http load a library when the server asked for Negotiate. - KRB5_CONFIG and SASL_PATH made libkrb5 and libsasl2 load a module in a probe of the library. No child here reached that call without a credential or an LDAP server. - PYTHONEXECUTABLE and __PYVENV_LAUNCHER__ made Python run the .pth line of a virtual environment that the key names. The design names the keys that stay accepted, for example SSL_CERT_FILE, and the reason. ARCHITECTURE.md and the purpose of the subprocess-environment spec name the library keys. Closes #2503
Archive 2503-refuse-library-code-env-keys. The subprocess-environment spec now holds its requirements.
Owner
Author
|
Test results, run on this branch after the rebase onto
Fail-to-pass ( Each of the 77 failures is "DID NOT RAISE SecurityError": 19 keys, in upper and lower case, with isolation on and off, and the Two independent reviews found no defect in the guard. Their findings on sentence length, the spec text, the comments of the constant and the commit text are fixed. |
dan-petty
marked this pull request as ready for review
October 29, 2026 16:14
dan-petty
pushed a commit
that referenced
this pull request
Oct 29, 2026
🤖 I have created a release *beep* *boop* --- ## [0.17.0](v0.16.7...v0.17.0) (2026-10-29) ### Features * **repos:** worktrees add takes over a staged branch ([#2675](#2675)) ([03eadec](03eadec)), closes [#2657](#2657) * **roadmap:** check open items for open alternative tools ([#2681](#2681)) ([4f993dc](4f993dc)), closes [#2650](#2650) ### Bug Fixes * **security:** refuse the library keys that load a module ([#2682](#2682)) ([e681884](e681884)), closes [#2503](#2503) --- 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.
build_subprocess_envrefuses the keys that make a library or Python load a module of the caller. It refuses eachOPENSSLkey and eachKRB5key. It also refusesGSS_MECH_CONFIG,SASL_PATH,PYTHONEXECUTABLEand__PYVENV_LAUNCHER__. Each raises the sameSecurityErroras the other refused keys, with isolation on and off.Why: a library key has an effect in each program that links the library.
OPENSSL_CONFnames a configuration file that can name a provider or an engine, which is a shared library. The four OpenSSL keysOPENSSL_CONF,OPENSSL_CONF_INCLUDE,OPENSSL_MODULESandOPENSSL_ENGINESare security-sensitive inopenssl-env(7).Evidence, from probes with the real programs in a temporary directory:
OPENSSL_CONFmadenode,curl,ssh,openssland Python load a provider module.git ls-remote ssh://ran it in itssshchild.gitover HTTPS did not, because git of the devcontainer links GnuTLS.OPENSSL_MODULESandOPENSSL_CONF_INCLUDEmadeopensslload a module when a configuration named a provider or a relative include.OPENSSL_ENGINESdid so foropenssl engine.GSS_MECH_CONFIGmadecurl --negotiateandgit-remote-httpload a library when the server asked for Negotiate.KRB5_CONFIGandSASL_PATHmadelibkrb5andlibsasl2load a module in a probe of the library. No child here reached that call without a credential or an LDAP server.PYTHONEXECUTABLEand__PYVENV_LAUNCHER__made Python run the.pthline of a virtual environment that the key names.Decisions:
OPENSSL*andKRB5*are patterns, not name lists, as the git keys are since fix(security): the subprocess environment guard accepts the git keys that make a git child run a program #2483. No caller sets a key of them. A key that a library adds later stays refused until a person reviews it.SSL_CERT_FILE,SSL_CERT_DIR,HOME,XDG_CONFIG_HOME,LOCPATHandNLSPATH.DEFAULT_ALLOWED_ENV_VARSorDEFAULT_ALLOWED_ENV_PREFIXESmatches a new pattern.uv,npmorgostart a program. fix(security): the subprocess environment guard accepts the keys that make a child write TLS secrets or a log to a file that the caller names #2674 holds the keys that make a child write a file.Change: openspec/changes/archive/2026-10-29-2503-refuse-library-code-env-keys/
Closes #2503