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 (#2205, #2433, #2429; the git keys follow in #2483). It accepts the ssh keys that make an ssh child run a program that its caller did not choose:
SSH_ASKPASSnames a program thatssh,ssh-addandssh-keygenstart to ask for a passphrase.SSH_ASKPASS_REQUIRE=forcemakessshstart that program also when a terminal is present.
A git child that opens an SSH connection starts ssh, so a caller override of these keys reaches it too. The same class holds the keys that name a program for gh and kubectl, for example GH_EDITOR, GH_BROWSER, KUBE_EDITOR and KUBECTL_EXTERNAL_DIFF. This issue does not claim them: no probe of them ran.
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={"SSH_ASKPASS": "x", "SSH_ASKPASS_REQUIRE": "force"}) if k.startswith("SSH_")))'. - In a temporary directory
<dir>, runssh-keygen -q -t ed25519 -N pw -f <dir>/k, and write an executable<dir>/askpassthat runsecho SSH-ASKPASS-RAN >&2; echo pw. - Run
env -i PATH=/usr/bin:/bin HOME=<dir> SSH_ASKPASS=<dir>/askpass SSH_ASKPASS_REQUIRE=force ssh-agent sh -c 'ssh-add <dir>/k </dev/null'.
Expected vs Actual Behavior
Expected: build_subprocess_env raises SecurityError for a caller override of an ssh key that makes ssh run a program, or the design of the guard names each such key that it accepts and the reason.
Actual: step 1 returns both keys with no SecurityError. Step 3 prints SSH-ASKPASS-RAN, so ssh-add runs the program of the override.
Environment Diagnostics
- DevOps CLI Version: main at a3eb41f
- 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 HOME=<dir> SSH_ASKPASS=<dir>/askpass SSH_ASKPASS_REQUIRE=force ssh-agent sh -c 'ssh-add <dir>/k </dev/null' # OpenSSH 10.6p1
SSH-ASKPASS-RAN
Identity added: <dir>/kPre-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: #2483
Proposed design
Problem statement
The guard in build_subprocess_env accepts caller overrides of SSH_ASKPASS and SSH_ASKPASS_REQUIRE. These keys make an ssh child run a program that the caller chose. A git child that opens an SSH connection starts ssh, so the override reaches it. The guard must refuse these two keys.
Acceptance criteria
Requirement: Refuse SSH_ASKPASS override
build_subprocess_env SHALL raise SecurityError when a caller override sets SSH_ASKPASS.
Scenario: Caller sets SSH_ASKPASS
- WHEN A caller passes env={'SSH_ASKPASS': '/path/to/program'} to build_subprocess_env
- THEN build_subprocess_env raises SecurityError
Requirement: Refuse SSH_ASKPASS_REQUIRE override
build_subprocess_env SHALL raise SecurityError when a caller override sets SSH_ASKPASS_REQUIRE.
Scenario: Caller sets SSH_ASKPASS_REQUIRE
- WHEN A caller passes env={'SSH_ASKPASS_REQUIRE': 'force'} to build_subprocess_env
- THEN build_subprocess_env raises SecurityError
Existing Tool Considered
The project builds its own guard. No open library covers this need. The mechanism is CONST_CODE_LOADING_ENV_PATTERNS in src/devops_cli/config/constants.py, matched by _is_env_override_refused in src/devops_cli/core/process.py. The cost is two entries in a tuple and one test.
Key questions
- Where to add the refused keys?: Add SSH_ASKPASS and SSH_ASKPASS_REQUIRE to CONST_CODE_LOADING_ENV_PATTERNS in src/devops_cli/config/constants.py. (best practice) [sources: src/devops_cli/core/process.py, openspec/changes/archive/2026-10-28-2205-refuse-code-loading-env-keys/design.md]
- Chosen: Add to CONST_CODE_LOADING_ENV_PATTERNS. The existing mechanism for refusing code-loading keys. The guard already matches this constant via _is_env_override_refused.
- Rejected: Add to DEFAULT_DENIED_ENV_PATTERNS. That tuple holds credential patterns. SSH_ASKPASS is a program path, not a credential.
- Rejected: Create a new constant. The existing constant and guard handle this. A new constant adds no value.
- Does the ambient filter already strip SSH_ASKPASS from the environment?: Yes. SSH_ASKPASS is not in DEFAULT_ALLOWED_ENV_VARS and does not match any entry in DEFAULT_ALLOWED_ENV_PREFIXES, so the ambient filter already removes it. [sources: src/devops_cli/core/process.py]
Open questions
- Which SSH keys make an ssh child run a caller-chosen program? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Oct 29, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The candidate reports that the guard accepts keys that let an ssh child run a caller-chosen program, which is a security defect.A caller can make an ssh child execute an arbitrary program via SSH_ASKPASS, which is a code-execution path.Closing this gap removes a path where a subprocess can run a program the caller did not choose.The fix adds two known key names to the existing guard pattern or blocklist in one function.Both fix the same guard in build_subprocess_env for keys that let a child run code, but this candidate targets SSH_ASKPASS keys while #2503 targets library-loading keys like OPENSSL_CONF.fix(security): refuse the git keys that make git run a program (#2641)
devops-cli-service commentedon Oct 29, 2026
Refine cannot set this item to Ready at 8036e7e until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
chore(main): release 0.16.7 (#2680)
fix(security): refuse the gh and kubectl keys that run a program (#2732)