Repository navigation
Description
Problem Description
The change for #2673 refuses the uv and npm keys that a probe showed make a child run a program. It claims nothing for the keys below, because no probe ran for them. build_subprocess_env in src/devops_cli/core/process.py accepts all of them from a caller today.
GOFLAGS: the page ofgo help buildsays that-toolexecmakesgorun a program of the caller in place of the compiler tools, andGOFLAGScan carry the flag.gois not in the devcontainer, so no probe ran. devops-cli does not startgotoday.YARN_YARN_PATH: the settingyarnPathof Yarn can name a JavaScript file that Yarn runs. A key of this form may run it. devops-cli does not startyarn.- The file keys
UV_ENV_FILE,UV_TOOL_DIRandnpm_config_cache: each names a directory or a file that the caller controls. No probe ran for them, and nothing is claimed.
Reproduction Steps
- Run
uv run python -c 'from devops_cli.core.process import build_subprocess_env as b; print(sorted(k for k in b(env={"GOFLAGS": "x", "YARN_YARN_PATH": "x", "UV_ENV_FILE": "x", "UV_TOOL_DIR": "x"})))'. - For each key, install the tool, run it with
env -i, a temporaryHOME, a marker program and a control run without the key, and read the marker. Use no network and start no long-running process.
Expected vs Actual Behavior
Expected: for each key, a probe result recorded in a change. A key that makes the tool start a program that the caller names is refused with SecurityError. A key that does not is named, with the reason, in the design of that change.
Actual: step 1 returns each key with no SecurityError, and no probe result exists.
Environment Diagnostics
- DevOps CLI Version: main at 1cd187e
- Execution Environment: DevContainer, no
goand noyarn
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.
Proposed design
Problem statement
The subprocess guard in build_subprocess_env accepts five environment variable keys. These keys can make a child process execute caller-named code. The keys are GOFLAGS, YARN_YARN_PATH, UV_ENV_FILE, UV_TOOL_DIR, and npm_config_cache. No probe result exists for any of them. The change probes each key and refuses the dangerous ones with SecurityError.
Acceptance criteria
Requirement: Probe result recorded
The change SHALL record a probe result for each of the five keys.
Scenario: All five keys probed
- WHEN The change is complete
- THEN The design names each key and its probe result
Requirement: GOFLAGS refused
build_subprocess_env SHALL raise SecurityError when a caller sets GOFLAGS.
Scenario: Caller sets GOFLAGS
- WHEN A caller passes
GOFLAGSin the env dict - THEN
build_subprocess_envraisesSecurityError
Requirement: YARN_YARN_PATH refused
build_subprocess_env SHALL raise SecurityError when a caller sets YARN_YARN_PATH.
Scenario: Caller sets YARN_YARN_PATH
- WHEN A caller passes
YARN_YARN_PATHin the env dict - THEN
build_subprocess_envraisesSecurityError
Requirement: UV_ENV_FILE refused
build_subprocess_env SHALL raise SecurityError when a caller sets UV_ENV_FILE.
Scenario: Caller sets UV_ENV_FILE
- WHEN A caller passes
UV_ENV_FILEin the env dict - THEN
build_subprocess_envraisesSecurityError
Requirement: UV_TOOL_DIR documented
The design SHALL name UV_TOOL_DIR and give the reason for its status.
Scenario: UV_TOOL_DIR documented
- WHEN The change is complete
- THEN The design names
UV_TOOL_DIRand its reason
Requirement: npm_config_cache documented
The design SHALL name npm_config_cache and give the reason for its status.
Scenario: npm_config_cache documented
- WHEN The change is complete
- THEN The design names
npm_config_cacheand its reason
Existing Tool Considered
No check has run. The project builds its own subprocess guard in src/devops_cli/core/process.py. The written cost is the tokens to add the denied keys to CONST_CODE_LOADING_ENV_PATTERNS, write the probe scripts for go, yarn, uv, and npm, and maintain the guard entries.
Key questions
- Which keys make a tool start a caller-named program?: Refuse
GOFLAGS,YARN_YARN_PATH, andUV_ENV_FILE. DocumentUV_TOOL_DIRandnpm_config_cacheas safe.GOFLAGScarries-toolexec, which runs a caller-named program.YARN_YARN_PATHnames a JavaScript file that Yarn runs.UV_ENV_FILEnames a file that uv sources, which can execute code.UV_TOOL_DIRandnpm_config_cachename directories that do not start a caller-named program. (best practice) [sources: src/devops_cli/core/process.py, ARCHITECTURE.md]- Rejected: Refuse all five keys. Rejected.
UV_TOOL_DIRandnpm_config_cachename directories that do not start a caller-named program. Refusing them blocks legitimate use without a security gain. - Rejected: Refuse three, document two. Chosen. It matches the criterion in the issue: refuse keys that make a tool start a caller-named program, document the rest with a reason.
- Rejected: Document all five. Rejected.
GOFLAGSandYARN_YARN_PATHclearly make a tool run caller-named code. Documenting them as safe leaves a known code-execution path open.
- Rejected: Refuse all five keys. Rejected.
- Where to add the denied keys?:
CONST_CODE_LOADING_ENV_PATTERNSinsrc/devops_cli/config/constants.py. The function_is_env_override_refusedinsrc/devops_cli/core/process.pychecks caller-provided keys against this list and raisesSecurityError. [sources: src/devops_cli/core/process.py, ARCHITECTURE.md] - How to probe each key?: Install the tool, run it with
env -i, a temporaryHOME, a marker program, and a control run without the key. Read the marker. Use no network and start no long-running process. (best practice) [sources: src/devops_cli/core/process.py]- Rejected: Live probe with marker program. Chosen. It confirms the tool actually runs the caller-named code. The issue describes this method.
- Rejected: Static analysis of tool source. Rejected. It is less reliable than a live probe. A tool may change behavior between versions.
- Rejected: Skip the probe, refuse all. Rejected. The issue requires a probe result for each key. Refusing without a probe leaves no record of why.
- Does the devcontainer have
goandyarn?: No. The devcontainer has nogoand noyarn. The probe requires installing them. This is part of the work, not a block. [sources: src/devops_cli/core/process.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Oct 30, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(security)scope of the title gives the scope.Security hardening for tools devops-cli does not start today, so the risk is lower than for actively used tools.Prevents future code-execution paths if go, yarn, or file-path keys are added, but no current user is affected.Requires probing five keys across three tools, recording results, and updating the guard and design notes.Both harden build_subprocess_env against keys that make a child run a program, but the candidate covers keys of go, yarn, and file-path keys that #2673 did not probe or claim.devops-cli-service commentedon Oct 30, 2026
Status set to Ready at d264e6e (see proposed design in issue body).
devops-cli-service commentedon Nov 2, 2026
Staged: branch
fix/2750-probe-the-go-yarn-and-file, draft pull request #3165. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:
docs(openspec): fix plan #2750 with probe results
docs(openspec): plan #2750 Refuse Go, Yarn and uv env keys (#3165)
[-]fix(security): probe the Go, Yarn and file keys that the subprocess guard accepts[/-][+]fix(security): Refuse Go, Yarn and uv env keys[/+]dan-petty commentedon Nov 6, 2026
The job shortened the title of this item. The summary had 66 characters, and the limit is 60. The type and the scope stay.
fix(security): probe the Go, Yarn and file keys that the subprocess guard acceptsfix(security): Refuse Go, Yarn and uv env keysdan-petty commentedon Nov 6, 2026
Answer from project standards, under the owner's instruction of 2026-11-05.
Question: refuse or document
UV_TOOL_DIRandnpm_config_cache?Answer:
UV_TOOL_DIRis refused. A probe with uv 0.11.32 shows thatuv tool runanduvxstart the executable of a tool environment in that directory. The issue says to refuse a key that makes the tool start a program that the caller names.npm_config_cachestays accepted and is documented: the probe shows thatnpxstarts a program from a prepared cache, butdevops install-toolssets the key fornpm ci, and devops-cli runs nonpx.GOFLAGS(-toolexecran the program),YARN_YARN_PATH(read from the bundle of Yarn 4.9.2) andUV_ENV_FILE(it loadsLD_PRELOAD,NODE_OPTIONSandPYTHONSTARTUPinto the program ofuv run) are refused.Source: the issue's own criterion, the guard in
src/devops_cli/core/process.py, and the design of the change in pull request #3845.A person must still run Yarn 4 once to confirm
YARN_YARN_PATH; the sandbox refused to run downloaded code.devops-cli-service commentedon Nov 6, 2026
Released in v0.73.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.73.0
devops-cli-service commentedon Nov 6, 2026
Live since 2026-11-06 22:09 UTC