Repository navigation
Description
Problem Description
GH_TELEMETRY_ENDPOINT_URL is a key that the gh binary reads (grep of the installed gh 2.103.3 shows the name next to GH_TELEMETRY and GH_TELEMETRY_SAMPLE_RATE). It appears to name the URL that gh sends its telemetry to. build_subprocess_env in src/devops_cli/core/process.py accepts a caller override of it, so a caller can send the telemetry of a gh child to a host that it names. That is egress of command data, not code execution.
I did not probe this key. The name comes from the strings of the gh binary, and gh help environment does not list it. The first step of the fix is a probe: run gh with GH_TELEMETRY=log or a loopback server, a temporary HOME and a fake token, and see what gh sends and where. #2672 (PR #2732) refuses the gh keys that make gh run a program and does not cover this key.
Reproduction Steps
- Run
uv run python -c 'from devops_cli.core.process import build_subprocess_env as b; print(b(env={"GH_TELEMETRY_ENDPOINT_URL": "https://example.com"}))'. - Check that the output holds the key and that no
SecurityErroris raised. - Probe gh with a loopback endpoint, to see what a gh command sends. This step is still to do.
Expected vs Actual Behavior
Expected: the guard refuses the key, or the design of the fix names the reason to accept it, after a probe shows what gh sends. Actual: the guard returns the key unchanged.
Environment Diagnostics
- DevOps CLI Version: main after fix(security): refuse the gh and kubectl keys that run a program #2732
- Execution Environment: DevContainer
- gh 2.103.3
Logs, Traces, or Terminal Output
Not probed.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 environment guard in build_subprocess_env accepts a caller override of GH_TELEMETRY_ENDPOINT_URL. This key names the URL that the gh binary sends its telemetry to. A caller can therefore redirect gh telemetry to a host it names, which is egress of command data to an arbitrary destination. The guard already refuses code-loading keys, but it does not refuse data-egress keys that name a network destination.
Acceptance criteria
Requirement: Refuse GH_TELEMETRY_ENDPOINT_URL caller override
build_subprocess_env SHALL raise SecurityError when a caller provides GH_TELEMETRY_ENDPOINT_URL in the env parameter.
Scenario: Caller sets the telemetry endpoint key
- WHEN build_subprocess_env is called with env={"GH_TELEMETRY_ENDPOINT_URL": "
https://example.com"} - THEN a SecurityError is raised and the key is not in the returned environment
Requirement: Ambient path already excludes the key
The ambient environment filter SHALL exclude GH_TELEMETRY_ENDPOINT_URL because it is not in DEFAULT_ALLOWED_ENV_VARS and matches no allowed prefix.
Scenario: Ambient environment holds the key
- WHEN os.environ contains GH_TELEMETRY_ENDPOINT_URL and isolate_env is True
- THEN the key is absent from the returned environment dictionary
Requirement: Other GH_TELEMETRY keys are not refused
build_subprocess_env SHALL NOT raise SecurityError for a caller override of GH_TELEMETRY or GH_TELEMETRY_SAMPLE_RATE.
Scenario: Caller sets the telemetry toggle key
- WHEN build_subprocess_env is called with env={"GH_TELEMETRY": "log"}
- THEN no SecurityError is raised and the key is present in the returned environment
Existing Tool Considered
No check has run. The change adds one key to the project's own refused-env-var list in src/devops_cli/core/process.py and src/devops_cli/config/constants.py, plus one test case. The written cost is about 15 lines of code and test, well under one page of tokens to build, keep and fix.
Key questions
- What does GH_TELEMETRY_ENDPOINT_URL do in the gh binary?: It names the URL that gh sends its telemetry to. The name appears in the strings of gh 2.103.3 next to GH_TELEMETRY and GH_TELEMETRY_SAMPLE_RATE. gh help environment does not list it. The project's archived design for fix(security): the subprocess environment guard accepts the gh and kubectl keys that make a child run a program #2672 records it as naming a place for data, not a program. [sources: openspec/changes/archive/2026-10-30-2672-refuse-gh-kubectl-code-env-keys/design.md:26]
- Should the guard refuse GH_TELEMETRY_ENDPOINT_URL as a caller override?: Yes. A caller must not redirect gh telemetry to a host it names. The key names a network destination, which is egress of command data. The project principle is to give a child only the keys it needs, and no legitimate caller needs to redirect gh telemetry to a custom URL. (best practice) [sources: ARCHITECTURE.md:181, src/devops_cli/core/process.py]
- Chosen: Refuse the key. A caller naming a telemetry destination is egress of data to an arbitrary host. No legitimate caller needs this.
- Rejected: Accept the key with a documented reason. Rejected because no caller in this project needs to redirect gh telemetry to a custom URL, and the principle of least privilege applies.
- Should GH_TELEMETRY and GH_TELEMETRY_SAMPLE_RATE also be refused?: No. They control whether telemetry is on and the sample rate, but they do not name a destination. Only GH_TELEMETRY_ENDPOINT_URL names a URL that data is sent to, making it the egress vector. (best practice) [sources: openspec/changes/archive/2026-10-30-2672-refuse-gh-kubectl-code-env-keys/design.md:26]
- Chosen: Refuse only GH_TELEMETRY_ENDPOINT_URL. It is the only one of the three that names a network destination a caller can control.
- Rejected: Refuse all three GH_TELEMETRY keys. Rejected because the other two do not redirect data to a caller-controlled host; they only toggle or rate-limit telemetry to the default destination.
- Where in the code should the refusal be added?: Add GH_TELEMETRY_ENDPOINT_URL to a new constant of data-egress keys in src/devops_cli/config/constants.py, and extend _is_env_override_refused in src/devops_cli/core/process.py to also refuse keys in that set. This follows the existing pattern of named constants per category imported from devops_cli.config.constants. (best practice) [sources: src/devops_cli/core/process.py, src/devops_cli/config/constants.py]
- Chosen: New data-egress constant in constants.py. Follows the existing pattern of named constants per category (CONST_CODE_LOADING_ENV_PATTERNS, CONST_GH_TOKEN_ENV_VARS, etc.).
- Rejected: Add to DEFAULT_DENIED_ENV_PATTERNS. Rejected because that list filters the ambient environment path, which already excludes the key via the allowlist. It would also block the key from extra_allowed_keys, which is broader than needed.
- Rejected: Hardcode in _is_env_override_refused. Rejected because it does not follow the project's pattern of named constants imported from the config module.
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.A caller can redirect gh telemetry to an arbitrary host, which is a data-exfiltration gap in the security guard.Closing the gap stops a caller from exfiltrating command data through gh telemetry.The fix adds one key pattern to the existing refusal list, matching the pattern used for sibling keys.Both target build_subprocess_env for gh keys, but #2672 blocks code-execution keys while the candidate blocks a telemetry-egress key.devops-cli-service commentedon Oct 30, 2026
Status set to Ready at 07fb4c2 (see proposed design in issue body).
devops-cli-service commentedon Oct 30, 2026
The stage job stopped. The inputs of the step of the task group "Add data-egress constant and write failing test" hold 41463 tokens, over the budget of 40000 tokens, also after the model split the groups once. A person decides how to split the item. The job stages the item again when a person runs it with --item 2739.
The task groups:
fix(roadmap): measure a task group by the files its step reads (#2847)
devops-cli-service commentedon Oct 31, 2026
Staged: branch
fix/2739-the-subprocess-environment-guard-accepts-gh, draft pull request #2859. 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:
These paths of the plan are no file on the default branch, and no group creates them:
tests/test_process_env.py. A person checks that the plan names them right.docs(openspec): plan #2739 refuse GH_TELEMETRY_ENDPOINT_URL (#2859)
devops-cli-service commentedon Oct 31, 2026
Stopped at group 1.
Reason:
Last message of the agent: Perfect! This confirms the issue. The
GH_TELEMETRY_ENDPOINT_URLis being accepted when it shouldn't be. Now let's proceed with implementing the fix. First, I'll add the constant to constants.py:The job discarded this work. Read it before you retry:
The item is Ready again, and the job will not run it. Fix the cause. Then comment
implement: retry.The push of the commits that passed failed too.
git push --force-with-lease=fix/2739-the-subprocess-environment-guard-accepts-gh:ce704860ca706c42d8f4028342390ea220c088a0 origin fix/2739-the-subprocess-environment-guard-accepts-ghfailed: To https://github.com/dan-petty/devops-cli.git ! [rejected] fix/2739-the-subprocess-environment-guard-accepts-gh -> fix/2739-the-subprocess-environment-guard-accepts-gh (stale info) error: failed to push some refs to 'https://github.com/dan-petty/devops-cldevops-cli-service commentedon Oct 31, 2026
The runner Job devops-cli-runner-20261031-130959-b54a ended: succeeded.
The last lines of its log:
dan-petty commentedon Oct 31, 2026
implement: retry
devops-cli-service commentedon Oct 31, 2026
Pull request #2901 is ready for review. The checks passed.
Spend: 44 model requests, 1563656 input tokens, 7086 output tokens.