Skip to content

fix(config): the audit-keys alert names the removal commands - #2663

Merged
dan-petty merged 5 commits into
mainfrom
fix/2513-config-remove-plaintext-secret
Oct 29, 2026
Merged

dan-petty merged 5 commits into
mainfrom
fix/2513-config-remove-plaintext-secret

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

devops config audit-keys found a plaintext secret in a config file but named no command that removes it. The alert told the person to run devops config set <key> <val>. That command stores a credential in the keyring and writes no config file, so the plaintext value stayed and the audit failed again. A plain devops config unset <key> edits only the active file, so it could not remove a leak in another file.

The alert now gives two steps for each leak. Step 1 is devops config set <key>, with --from-file <path> for a multi-line credential, such as a PEM key. Step 2 is DEVOPS_CLI_CONFIG=<file> devops config unset <key>, which edits the file of the leak. This command already worked. No text named it, and the error of an unknown key already used it, so the change adds no option.

The alert also says to quote the file and the key. It says that step 2 keeps a copy <file>.bak-<time> that still holds the value, and that a person deletes the copy by hand. The alert and the line of an unaudited file print with safe=True, so a name such as [/x] does not stop the print. The help, the generated documents and the knowledge base name the same commands.

Follow-up items: #2645 (the copy holds the removed secret), #2656 (unset fails for a key from a YAML merge key), #2511 (nested secret keys).

Change: openspec/changes/archive/2026-10-29-2513-audit-keys-names-unset-command/

Closes #2513

Plans #2513. The change folder holds the proposal with its feasibility check,
the design, the spec delta for config-commands and the tasks.
The alert of `devops config audit-keys` named `devops config set <key> <val>`.
That command stores a credential in the keyring and writes no config file, so
the plaintext value stayed and the audit failed again. A plain
`devops config unset <key>` edits only the active file, so it could not remove
a leak in the global file while a project file was active.

The alert now names `devops config set <key>`, which asks for the value at a
hidden prompt, and `DEVOPS_CLI_CONFIG=<file> devops config unset <key>`, which
removes the value from the file of the leak. The same command is in the help
of `audit-keys`, in the help of `unset` and in the generated documents. The
tests follow the alert and check that the next audit passes.

Fixes #2513
A section name or a path such as `[/x]` is markup for the terminal. The
alert of a plaintext secret and the line of an unaudited file printed it
without a guard, so Rich raised a MarkupError and no alert showed. Both
lines now print with `safe=True`, as `devops config unset` does.
The review of the alert found four defects in its text.

- Step 1 named `devops config set <key>`. Its prompt reads one line, so
  a PEM key kept only its first line, and step 2 then removed the only
  complete copy from the file. The alert now adds `--from-file <path>`
  for a multi-line credential.
- The alert did not say to quote the file and the key. A section name with
  shell syntax ran when a person pasted the command. It now says to quote
  both values.
- The removal keeps a copy of the file that still holds the value, and the
  audit does not scan the copy. The alert now says to delete the copy by
  hand. The fix of the copy is #2645.
- The help, the generated documents and the knowledge base name the same
  steps. The design records the limit of the command: a key that a YAML
  merge key gives is #2656.

The text of the change and of the help is shorter, in ASD-STE100 sentences.
Archives the change folder of #2513 and merges its spec delta into the
config-commands capability.
@dan-petty dan-petty added scope/security Security linters (trivy, bandit, gitleaks, kubeconform) and Vault type/security Type security: a vulnerability or a leak labels Oct 29, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results at the head of this branch (rebased on origin/main ca9c1ad).

  • Targeted tests: tests/test_config_audit_keys.py, tests/commands/test_config.py, tests/test_config_cmd.py, tests/test_config_commands.py, tests/test_zero_plaintext_invariants.py, tests/test_docs_knowledge_base_argv.py, tests/test_language_catalogs.py, tests/test_instruction_generator.py: 121 passed.
  • ruff check, ruff format --check and mypy pass on the changed modules. devops docs check and devops openspec check pass.
  • devops ci fail-to-pass --base origin/main: 7 of the new or changed tests in tests/test_config_audit_keys.py fail on the base. 22 pass on both.
  failed on base: tests.test_config_audit_keys::test_config_audit_keys_prints_each_alert_for_a_name_that_holds_markup[True]
  failed on base: tests.test_config_audit_keys::test_config_audit_keys_alert_names_a_command_that_removes_the_leak_from_its_file[True]
  failed on base: tests.test_config_audit_keys::test_config_audit_keys_prints_each_alert_for_a_name_that_holds_markup[False]
  failed on base: tests.test_config_audit_keys::test_the_help_of_audit_keys_and_unset_name_the_command_that_removes_a_leak
  failed on base: tests.test_config_audit_keys::test_the_flow_that_the_alert_names_keeps_a_multi_line_credential_whole
  failed on base: tests.test_config_audit_keys::test_config_audit_keys_alert_names_a_command_that_removes_the_leak_from_its_file[False]
  failed on base: tests.test_config_audit_keys::test_config_audit_keys_alert_says_to_quote_the_values_and_to_delete_the_copy
7 failed on base (7 failed and 22 passed in tests/test_config_audit_keys.py; 0 errored).

@dan-petty
dan-petty marked this pull request as ready for review October 29, 2026 14:59
@dan-petty
dan-petty merged commit 3eb138d into main Oct 29, 2026
17 checks passed
@dan-petty
dan-petty deleted the fix/2513-config-remove-plaintext-secret branch October 29, 2026 15:06
dan-petty-release Bot added a commit that referenced this pull request Oct 29, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.16.5](v0.16.4...v0.16.5)
(2026-10-29)


### Bug Fixes

* **ai:** name benchmark servers and models by host and port
([#2666](#2666))
([8a08031](8a08031)),
closes [#2481](#2481)
* **config:** the audit-keys alert names the removal commands
([#2663](#2663))
([3eb138d](3eb138d)),
closes [#2513](#2513)
* **k8s:** the MCP tool k8s_logs takes no Loki URL
([#2668](#2668))
([39fae85](39fae85)),
closes [#2635](#2635)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/security Security linters (trivy, bandit, gitleaks, kubeconform) and Vault type/security Type security: a vulnerability or a leak

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(config): no devops config command removes a plaintext secret that audit-keys finds in a config file that is not the active file

1 participant