Skip to content

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

Description

@dan-petty

Problem Description

devops config audit-keys finds a plaintext secret in each config file that the settings merge, but no devops config command removes the secret from a file that is not the active config file. The alert of the audit says: "Migrate secrets to OS Keyring via 'devops config set ', and delete any key that is not a config option."

  • devops config set <key> <val> stores a credential in the keyring and writes no config file (save_settings(settings, keys=())). The plaintext value stays in each file that holds it, so the audit continues to fail.
  • devops config unset <key> edits only get_active_config_path(). When a project config file is active, the command does not edit the global config file ~/.config/devops-cli/config.yaml.

Thus, when the global config file holds a plaintext secret and a project config file is active, the person must find the file and edit it by hand. This is the usual case in the devcontainer, which sets DEVOPS_CLI_CONFIG.

Reproduction Steps

  1. Make a temporary HOME and a git repository in a temporary directory. Write ai: and api_key: FAKE-2426-value to $HOME/.config/devops-cli/config.yaml.
  2. Write log_level: INFO to .devcontainer/config.yaml in the repository. Do not set DEVOPS_CLI_CONFIG.
  3. Set PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring, and run devops config audit-keys in the repository.
  4. Run devops config unset ai.api_key in the repository.

Expected vs Actual Behavior

Expected: the alert names a command that removes the plaintext value from the file that the leak names, and the audit passes after that command. For example, devops config unset can take the file of the leak, or devops config set of a credential can remove the plaintext value from each config file that the settings merge.

Actual: step 3 exits 1 and names the global file. Step 4 exits 1 with "The config file /.devcontainer/config.yaml does not hold the key 'ai.api_key'. Nothing changed." The global file keeps the value, and the audit continues to fail.

Environment Diagnostics

devops-cli 0.10.0 on the branch of #2426, which makes the audit scan the global config file and makes a leak name the full path of its file. PyYAML 6.0.3, Python 3.14.10, Linux.

Logs, Traces, or Terminal Output

Security Alert: Found plaintext secrets stored in config files: ['<tmp>/.config/devops-cli/config.yaml:ai.api_key']. Migrate secrets to OS Keyring via 'devops config set <key> <val>', and delete any key that is not a config option.
audit exit=1
The config file <tmp>/proj/.devcontainer/config.yaml does not hold the key 'ai.api_key'. Nothing changed.
unset exit=1

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.

Source: #2426

Proposed design

Problem statement

devops config audit-keys reports a plaintext secret in a config file, but devops config unset edits only the active config file. When the secret is in a different file, no command removes it. The user must find and edit the file by hand. This blocks the remediation the audit recommends.

Acceptance criteria

  • Criterion 1: devops config unset --file removes the key from the named file.
    Verification: Run devops config unset ai.api_key --file ~/.config/devops-cli/config.yaml in a repo where the project config is active. Confirm the key is gone from the named file.
  • Criterion 2: After the unset command, devops config audit-keys no longer reports that key in that file.
    Verification: Run devops config audit-keys after the unset. Confirm exit code 0 and no alert for that key.
  • Criterion 3: The audit alert message names the --file option so the user knows how to remediate.
    Verification: Run devops config audit-keys with a plaintext secret present. Confirm the alert text includes 'devops config unset --file '.
  • Criterion 4: devops config unset without --file still edits only the active config file.
    Verification: Run devops config unset log_level in a repo with a project config active. Confirm only the project config file is edited.

Key questions

  • How should the user target a specific config file for key removal?: Add a --file flag to devops config unset. When present, the command edits the named file instead of get_active_config_path(). When absent, behavior is unchanged. (best practice) [sources: docs/CONFIGURATION.md:8]
    • Chosen: Add --file flag to unset. Explicit and targeted. The audit already names the file, so the user knows the path. No surprising side effects. Minimal change.
    • Rejected: Make unset remove the key from all config files in the merge. Broader than needed. Could remove a key the user wants to keep in one file. Surprising side effect.
    • Rejected: Make set also remove the plaintext from all config files. set is for storing a new value in the keyring. Adding file-deletion as a side effect is not obvious and couples two concerns.
  • Should the audit alert message be updated to reference the new --file option?: Yes. The alert should say: 'Migrate secrets to OS Keyring via devops config set , and remove the key from the named file via devops config unset --file .' (proposed)
    • Chosen: Update the alert to name --file. The alert is the user's only guidance. It must name a command that actually works for the reported file.
    • Rejected: Leave the alert unchanged. The current text only names devops config set, which does not remove the plaintext. The user is left without a working command.
  • What is the config file resolution order that the settings merge uses?: 1. The file DEVOPS_CLI_CONFIG names. 2. The user-level config at ~/.config/devops-cli/config.yaml. 3. The nearest project config (config.yaml, .devcontainer/config.yaml, .devops/config.yaml, .devops.yaml, or .devcontainer/.devops.yaml) from the working directory up to the repository root. [sources: docs/CONFIGURATION.md:8]
  • Does devops config set write any config file?: No. devops config set calls save_settings(settings, keys=()), which stores the credential in the keyring and writes no config file. The plaintext value stays in each file that holds it. [sources: docs/CONFIGURATION.md:8]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/security
    status/new
    value/high
    effort/medium
    on Oct 28, 2026
  2. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/security. The gap leaves plaintext secrets on disk and blocks the remediation the audit recommends.
    • Priority: P1-High. Users cannot remove a plaintext secret that the audit reports, which blocks security compliance.
    • Value: High. Users are stuck with plaintext secrets they cannot remove via the tool.
    • Effort: Medium. Requires modifying unset or set to target a specific file or all merged config files.
    • Related: fix(config): devops config audit-keys does not find a plaintext secret under a nested key such as service.github_app.private_key #2511, which asks for a different change. Both involve devops config audit-keys and plaintext secrets in config files, but #2511 fixes the audit's scan depth while the candidate fixes the removal command's file scope.
  3. added
    priority/p1-high
    on Oct 28, 2026
  4. added
    status/ready
    and removed
    status/new
    on Oct 29, 2026
  5. devops-cli-service commented on Oct 29, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at ef6e028 (see proposed design in issue body).

  6. added a commit that references this issue on Oct 29, 2026
    3eb138d
  7. removed
    status/ready
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p1-highsource/agenttype/securityvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions