Repository navigation
Description
Problem Description
A person merged PR #2401 (issue #1469), PR #2402 (issue #1492) and PR #2405 (issue #2205) before their review, fixes and OpenSpec archive ran. The review then found these defects on main. Each is in the scope of its issue:
- The three change folders are still active:
openspec/changes/1469-audit-keys-leak-exit-code/,openspec/changes/1492-drop-gh-go-trivy-ignores/andopenspec/changes/2205-refuse-code-loading-env-keys/. Thusopenspec/specs/does not hold the exit-code requirement ofconfig-commandsor the new capabilitysubprocess-environment. AGENTS.md rule 1 says that the pull request archives its change. - fix(config): devops config audit-keys exits 1 when it finds a plaintext secret #1469: two scenario clauses of the spec have no test assertion.
test_config_audit_keys_table_renderingdoes not check the success line of a compliant audit. The table test of a leak checks only the textSecurity Alert, not that the alert names the leak. - fix(security): the service image ships a gh built with go 1.27.2 or later, and the two go stdlib ignores are dropped #1492: the two gh pin tests are in the flat file
tests/test_service_image_gh.py. docs/TESTING.md puts an invariant test intests/invariants/, one file per subject. The digest invariant of the same Dockerfile is intests/test_architectural_invariants.py. - fix(security): the service image ships a gh built with go 1.27.2 or later, and the two go stdlib ignores are dropped #1492: the pin test sees a gh URL only as a bare whitespace-split token. A gh URL in quotes, or with a character in front of it, is not seen.
- fix(security): the subprocess environment guard refuses ld_audit, every dyld_ key and exported bash functions #2205: the guard accepts
GCONV_PATH, which the issue covers as a glibc key that loads code.iconv_open(3)loads the gconv modules from the directories thatGCONV_PATHnames. - fix(security): the subprocess environment guard refuses ld_audit, every dyld_ key and exported bash functions #2205: the guard accepts the bash keys
SHELLOPTS,BASHOPTSandPS4. bash enables the options ofSHELLOPTSandBASHOPTSat start. Withxtraceon, bash expandsPS4, command substitution included, before each command. - fix(security): the subprocess environment guard refuses ld_audit, every dyld_ key and exported bash functions #2205: no test pins the rule that every key that starts with
DYLD_orBASH_FUNC_is refused. A narrower pattern passes the whole suite. - fix(security): the subprocess environment guard refuses ld_audit, every dyld_ key and exported bash functions #2205:
ARCHITECTURE.mdsays thatbuild_subprocess_envgives a child the environment without credentials. That is true only withisolate_env=True. The bullet also breaks the STE rules: a sentence of 35 words, and "and more" in place of the list. The comment ofCONST_CODE_LOADING_ENV_PATTERNSis one sentence of about 60 words.
Reproduction Steps
- Run
ls openspec/changes/on main. - Run
uv run python -c 'from devops_cli.core.process import build_subprocess_env as b; print(sorted(b(env={"GCONV_PATH": "x", "SHELLOPTS": "xtrace", "PS4": "x", "BASHOPTS": "x"})))'. - Run
subprocess.run(["bash", "-c", "true"], env=build_subprocess_env(env={"SHELLOPTS": "xtrace", "PS4": "$(echo PS4-CODE-RAN >&2)+ "})). - In the pin test, add a quoted
RUN curl ... "https://github.com/cli/cli/releases/download/v2.102.0/..."line to a copy of the Dockerfile. The test passes.
Expected vs Actual Behavior
Expected: main holds no active change folder of a merged item. The guard refuses GCONV_PATH, SHELLOPTS, BASHOPTS and PS4. The tests pin each spec clause and each family pattern, and the Service image invariants are in one subject file. The documents say what the guard does.
Actual: the three folders are active. Step 2 returns all four keys with no SecurityError. Step 3 prints PS4-CODE-RAN before the command runs. The tests pass on the mutants that items 2, 4 and 7 name.
Environment Diagnostics
- DevOps CLI Version: main at d739a47
- Python Version: 3.14.10
- OS & Architecture: Linux x86_64 (WSL2)
- Execution Environment: DevContainer
Logs, Traces, or Terminal Output
$ env -i PATH=/usr/bin:/bin SHELLOPTS=xtrace PS4='$(echo PS4-CODE-RAN >&2)+ ' bash -c true # bash 5.3.15
PS4-CODE-RAN
+ true
$ GCONV_PATH=<dir> iconv -f PWN -t UTF-8 # glibc 2.43, <dir> holds gconv-modules and x.so
GCONV-CODE-RANThe out-of-scope findings of the same reviews are in #2426 and #2429, and in a comment on #2255. The merge commit of PR #2401 names the active change folder and has no Change: line. A rewrite of main is the only way to change it, so this item does not change it.
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: #2405
Proposed design
Problem statement
The guard in build_subprocess_env accepts GCONV_PATH, SHELLOPTS, BASHOPTS, and PS4, which let a child process load or run attacker-chosen code. Three change folders of merged items are still active. The gh pin test misses quoted URLs. No test pins the DYLD_ and BASH_FUNC_ family patterns. ARCHITECTURE.md states a wrong condition for build_subprocess_env.
Acceptance criteria
- Criterion 1: The three change folders are archived into openspec/changes/archive/.
Verification: Runls openspec/changes/. No folder for 1469, 1492, or 2205 appears. Runls openspec/changes/archive/. All three folders appear. - Criterion 2: The guard refuses GCONV_PATH, SHELLOPTS, BASHOPTS, and PS4.
Verification: Runuv run python -c 'from devops_cli.core.process import build_subprocess_env as b; b(env={"GCONV_PATH": "x", "SHELLOPTS": "xtrace", "PS4": "x", "BASHOPTS": "x"})'. The command raises SecurityError. - Criterion 3: The compliant-audit test asserts the success line. The leak test asserts the alert names the leaked key.
Verification: Read test_config_audit_keys_table_rendering. It asserts the success line text of a compliant audit. The leak table test asserts the alert text names the leaked key, not only the text Security Alert. - Criterion 4: The gh pin tests sit in a file under tests/invariants/.
Verification: The file tests/test_service_image_gh.py does not exist. A file under tests/invariants/ holds the two gh pin tests. - Criterion 5: The gh pin test catches a quoted URL and a URL with a character in front.
Verification: Add a line RUN curl ... "https://github.com/cli/cli/releases/download/v2.102.0/..."to a copy of the Dockerfile. The test fails. - Criterion 6: A test fails when a narrower pattern replaces the DYLD_ or BASH_FUNC_ prefix rule.
Verification: Remove the DYLD_ prefix from CONST_CODE_LOADING_ENV_PATTERNS. Run the new test. It fails. Restore the prefix. The test passes. - Criterion 7: ARCHITECTURE.md names isolate_env=True as the condition for credential removal. No sentence exceeds 25 words. No 'and more' replaces a list.
Verification: Read the build_subprocess_env bullet in ARCHITECTURE.md. It names isolate_env=True. Count the words in each sentence. None exceeds 25. The list is written out, not shortened with 'and more'. - Criterion 8: The comment of CONST_CODE_LOADING_ENV_PATTERNS is 25 words or fewer.
Verification: Read the comment above CONST_CODE_LOADING_ENV_PATTERNS in src/devops_cli/core/process.py. Count the words. The total is 25 or fewer.
Key questions
- Where do invariant tests belong?: In tests/invariants/, one file per subject. [sources: docs/TESTING.md]
- Which environment keys must the guard add to its refusal list?: GCONV_PATH, SHELLOPTS, BASHOPTS, and PS4, in addition to the existing DYLD_ and BASH_FUNC_ prefix patterns. [sources: src/devops_cli/core/process.py]
- Should the merge commit of PR fix(config): exit 1 when audit-keys finds a plaintext secret #2401 be changed?: No. A rewrite of main is the only way to change it, and this item does not change it. (proposed)
- What detection method does the gh pin test use today?: It splits the Dockerfile on whitespace and checks each token for the gh release URL prefix. A quoted URL or a URL with a character in front is not seen. [sources: tests/test_service_image_gh.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
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 on the board.
The core fix refuses environment keys that let a child process load or run attacker-chosen code.GCONV_PATH and PS4 enable confirmed code execution in a child process, as shown by the reproduction output.Closing the guard stops a caller from running arbitrary code through the subprocess environment.The fix touches the guard, several test files, two doc files, and three archive folders.Both target build_subprocess_env in process.py; #2205 added LD_AUDIT and DYLD_* refusal, the candidate adds GCONV_PATH and bash trace keys plus tests for the #2205 patterns.dan-petty commentedon Oct 28, 2026
Status set to Ready at 19412fa (see proposed design in issue body).
fix(security): refuse GCONV_PATH, SHELLOPTS, BASHOPTS and PS4 from a …