Repository navigation
Description
Problem Description
devops config unset <key> --dry-run prints the unified diff of the removal. When the key is a plaintext credential, the diff holds the line of the credential, with its value. The command prints it in the console, so the value reaches the terminal, the scroll-back, a CI log or any tool that captures the output. The command exists to remove a credential from the file, and its preview prints that credential.
The live run prints no value: it prints the key, the file and the line only. The preview must print no value either. ConfigKeyRemoval.diff in src/devops_cli/models/config.py is built in remove_config_key in src/devops_cli/config/settings.py, with difflib.unified_diff over the whole text, and unset_value in src/devops_cli/commands/config.py passes its lines to render_dry_run_result.
Reproduction Steps
- Make a temporary
HOME. Write the sectionaito$HOME/.config/devops-cli/config.yaml, with the keysapi_key(a fake value of your own) andmodel. - Set
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring. UnsetDEVOPS_CLI_CONFIG. Rundevops config unset ai.api_key --dry-runin a directory with no project config file.
Expected vs Actual Behavior
Expected: the preview shows the key and its line, and shows no value of a credential. The value shows as a placeholder such as ***REDACTED***, as the copies of the file do after the change of #2645.
Actual: the diff list of the preview holds the removed line of ai.api_key with the fake value in clear text.
Environment Diagnostics
devops-cli 0.21.3 at origin/main ae446f0, Linux. Found while the change for #2645 (the copies of devops config unset hold no credential value) was built. That change redacts the copies, and it does not touch the preview.
Logs, Traces, or Terminal Output
"diff": [
"--- <tmp>/home/.config/devops-cli/config.yaml",
"+++ <tmp>/home/.config/devops-cli/config.yaml",
"@@ -2 +1,0 @@",
"- <the line of ai.api_key, with the fake value in clear text>"
]
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
devops config unset --dry-run prints the unified diff of the removal. For a plaintext credential, the diff holds the value of the credential. The value then reaches the terminal, the scroll-back, a CI log or any tool that captures the output. The live run shows no value, and the copies hold ***REDACTED*** after #2645. The preview must show no value either.
Acceptance criteria
Requirement: Dry-run diff redacts a credential value
The dry run of devops config unset SHALL show ***REDACTED*** in place of the value of a key in _SECRET_FIELDS and no text of that value.
Scenario: Dry run of a credential key
- WHEN The config file holds
ai.api_key: sk-ant-fake123and the user runsdevops config unset ai.api_key --dry-run. - THEN The diff holds the line of
ai.api_keywith***REDACTED***in place ofsk-ant-fake123, and no line of the diff holdssk-ant-fake123.
Requirement: Dry-run diff shows a non-credential value
The dry run of devops config unset SHALL show the value of a key that is not in _SECRET_FIELDS as the file writes it.
Scenario: Dry run of a non-credential key
- WHEN The config file holds
ai.model: llama3and the user runsdevops config unset ai.model --dry-run. - THEN The diff line for
ai.modelholdsllama3.
Requirement: Live removal is unchanged
The live run of devops config unset SHALL remove the key, redact the value in the copy, and print the key, the file and the line with no value.
Scenario: Live removal of a credential key
- WHEN The config file holds
ai.api_key: sk-ant-fake123and the user runsdevops config unset ai.api_keywith no--dry-run. - THEN The key is gone from the file, the
.bak-*copy holds***REDACTED***, and the output names the key, the file and the line and holds nosk-ant-fake123.
Existing Tool Considered
No alternatives check has run. No open, maintained tool or library covers the redaction of one value in a unified diff. The diff comes from difflib.unified_diff inside the command. The change reuses the project's own redaction from #2645. The written cost is about 40,000 tokens to build and test the redaction step. Each later fix costs about 2,000 tokens, and the elapsed time is about half a day.
Key questions
- How does the fix redact the credential value in the dry-run diff?: Redact the removed credential values in the source text, then compute the diff between that redacted text and the content with the key removed. Reuse the redaction that fix(config): devops config unset leaves the plaintext secret that it removes in its .bak copy #2645 added for the copies. Every line of the diff is then safe, and one implementation and one placeholder serve the copies and the diff. (best practice) [sources: src/devops_cli/config/settings.py, src/devops_cli/config/write_history.py, src/devops_cli/models/config.py]
- Chosen: Redact the source text with the fix(config): devops config unset leaves the plaintext secret that it removes in its .bak copy #2645 redaction before the diff. It covers the removed key and every credential that the removal takes out, and it keeps one placeholder and one implementation. The copies already use it.
- Rejected: Set the removed key to
***REDACTED***withround_trip.editand diff that text. It handles the line of the removed key only. A removed section that holds a credential, or a value that spans lines, keeps the value in the diff. - Rejected: Post-process the diff lines. It must parse each line to find the value, so a quoted or multi-line value escapes. It also needs a second redaction implementation.
- Rejected: Print no diff for a credential key. The preview must still show the key, the file and the line. A suppressed diff loses that.
- Which keys hold a credential that the preview must redact?: The keys in
_SECRET_FIELDS, the frozenset thatsecret_keys()builds fromCREDENTIALSinconfig/env.py. The live run redacts the copies with the same set, throughwrite_history.credential_paths. [sources: src/devops_cli/config/settings.py, src/devops_cli/config/env.py] - Does the fix depend on fix(config): devops config unset leaves the plaintext secret that it removes in its .bak copy #2645?: No. fix(config): devops config unset leaves the plaintext secret that it removes in its .bak copy #2645 changed the copies, and its code is in
_write_contentandwrite_historyat the base commit. This change redacts the diff text inremove_config_key, and it reads the same redaction. One pull request delivers it. [sources: src/devops_cli/config/settings.py, src/devops_cli/config/write_history.py] - Where does the fix redact the value: in the model or in the command that prints the preview?: In
remove_config_key, before it builds the diff.ConfigKeyRemoval.diffis the one value that the preview and the JSON output print, so a fix there covers every consumer. A fix in a renderer leaves the other consumers unsafe. (best practice) [sources: src/devops_cli/config/settings.py, src/devops_cli/models/config.py]- Chosen: Redact in
remove_config_keybefore the diff. The model field is the one source of the preview. Every consumer ofdiffis then safe. - Rejected: Redact in the command that renders the preview. It leaves the value in the model field, so another consumer or a later renderer prints it again.
- Chosen: Redact in
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-04: none.
Tool: none found.
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.(config)scope of the title gives the scope.A credential value is printed to stdout and can reach CI logs or scrollback, but only in a user-invoked preview mode.Leaking a plaintext credential to the terminal or a CI log is a direct security exposure for the user.The fix is a targeted redaction in the dry-run diff rendering, analogous to what #2645 already does for the .bak copy.Both fix credential leakage from devops config unset. #2645 redacts the .bak file copy; this candidate redacts the --dry-run console preview. Same area, different output surface.devops-cli-service commentedon Oct 30, 2026
Status set to Ready at 46fd02d (see proposed design in issue body).
devops-cli-service commentedon Nov 2, 2026
Staged: branch
fix/2740-devops-config-unset-dry-run-prints, draft pull request #3158. 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:
dan-petty commentedon Nov 2, 2026
returned per agent request
devops-cli-service commentedon Nov 2, 2026
Status set to Ready at bc0434e (see proposed design in issue body).
devops-cli-service commentedon Nov 4, 2026
Alternatives check: none
Tool: none found
Lacks:
_SECRET_FIELDS) inside a unified diff, while leaving non-credential values as the file writes them.redact-secret,pyveil) mask secret-looking strings by pattern for logs and prompts; they do not know which YAML key is a credential, so they miss a credential value that matches no known pattern and can mask a non-credential value.***REDACTED***, and reuses the redaction fix(config): devops config unset leaves the plaintext secret that it removes in its .bak copy #2645 added for the.bakcopies — a project-internal change inremove_config_key, not a library feature.difflib.unified_diffitself only computes the delta and emits the removed line verbatim; it offers no redaction of the line content.Searches run:
Sources:
Checked on 2026-11-04. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 4, 2026
#3218 supersedes this item, so this item closes as not planned. The body of #3218 and
openspec/changes/3218-config-unset-with-dry-run-deletes/proposal.mdboth say so. Its plan covers single keys, block scalars and removed sections.This item has no symptom today.
unset_valuecallsremove_config_key(key, dry_run=False)atsrc/devops_cli/commands/config.py:331and prints no preview. #3218 restores the preview with a redacted diff. PR #3158, the plan of this item, closed unmerged with the comment "Rejected" on 2026-11-02.What moved: the requirements on redaction, on the value of a key that is not a credential and on the live run are in the plan of #3218. One case was not in that plan: a comment line that holds the credential value. A comment on #3218 states the amendment that its tasks 1.1 and 1.2 and its spec delta need.
The status of this item stops a second plan, which would conflict with #3218. This item has no change folder and no open pull request.