Repository navigation
Description
Problem Description
devops config audit-keys does not find a plaintext secret under a key that has more than two levels. commands/config.py::_scan_yaml_for_secret_keys examines only <section>.<option>. The managed credential service.github_app.private_key has three levels, so the audit does not examine it in any config file that it scans.
The settings load ignores the value, because GitHubAppConfig has extra='ignore'. But the plaintext private key stays on disk, and the audit reports the config compliant. The help of the command says that it exits 1 when a config file holds a plaintext secret. That is false for this key.
Reproduction Steps
- Make a temporary
HOME. Writeservice:,github_app:andprivate_key: FAKE-PEM-0123to$HOME/.config/devops-cli/config.yaml. - Write
log_level: INFOto a clean file, and setDEVOPS_CLI_CONFIGto that file. - Set
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring. - Run
devops config audit-keys --json.
The same result occurs when the active config file holds the key, because the scanner is the same for each file.
Expected vs Actual Behavior
Expected: the report lists the leak of service.github_app.private_key under plaintext_leaks, is_compliant is false, and the command exits 1. The scanner examines each managed credential at its full dotted key (secret_keys()), at each depth.
Actual: the command exits 0 with is_compliant: true and plaintext_leaks: [].
Environment Diagnostics
devops-cli 0.10.0, source at origin/main 0137f23 and on the branch of #2426. PyYAML 6.0.3, Python 3.14.10, Linux.
Logs, Traces, or Terminal Output
{'scanned_config_files': ['<tmp>/.config/devops-cli/config.yaml', '<tmp>/proj/clean.yaml'], 'plaintext_leaks': [], 'is_compliant': True, 'unaudited_config_files': []}
exit=0
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
The devops config audit-keys command reports a config file as compliant when it holds a plaintext secret under a key deeper than two levels. The scanner _scan_yaml_for_secret_keys in commands/config.py examines only . pairs. The managed credential service.github_app.private_key has three levels, so the scanner never checks it. The command exits 0 and reports is_compliant: true even though a plaintext private key is on disk.
Acceptance criteria
Requirement: Detect secret at any depth
The scanner SHALL detect a plaintext secret value at any nesting depth in a YAML config file.
Scenario: Three-level key holds a plaintext value
- WHEN A config file contains
service.github_app.private_keyset to a non-empty string that is not a keyring reference - THEN The report lists
service.github_app.private_keyunderplaintext_leaks
Requirement: Compliance flag is false on leak
The report SHALL set is_compliant to false when any plaintext leak is found.
Scenario: One leak present
- WHEN The scanner finds one or more plaintext leaks in any scanned file
- THEN
is_compliantis false in the JSON report
Requirement: Exit code 1 on leak
The command SHALL exit with code 1 when a plaintext leak is found.
Scenario: Leak detected in active config
- WHEN The scanner reports at least one entry in
plaintext_leaks - THEN The process exit code is 1
Requirement: Use secret_keys registry
The scanner SHALL use the secret_keys() registry as the source of truth for which dotted keys to check.
Scenario: Registry key at depth three is checked
- WHEN
secret_keys()returnsservice.github_app.private_keyand the config file holds that key with a plaintext value - THEN The scanner navigates the parsed YAML by splitting the key on
.and reports the value as a leak
Requirement: Two-level keys still detected
The scanner SHALL continue to detect plaintext secrets at two-level keys such as grafana.token.
Scenario: Two-level key holds a plaintext value
- WHEN A config file contains
grafana.tokenset to a non-empty string that is not a keyring reference - THEN The report lists
grafana.tokenunderplaintext_leaks
Existing Tool Considered
The project's own scanner _scan_yaml_for_secret_keys in commands/config.py covers the need. It lacks correct traversal for keys deeper than two levels. The fix modifies the existing iteration loop to navigate each secret key from secret_keys() at its full dotted path. No new library is added. The cost is the tokens to change the loop and add one test for a three-level key, plus the time to run the test suite.
Key questions
- What is the source of truth for which dotted keys are managed secrets?: The
secret_keys()registry in the settings module. It returns the full dotted path of every managed credential, includingservice.github_app.private_key. [sources: src/devops_cli/config/settings.py:789, src/devops_cli/config/settings.py:829] - How should the scanner traverse the parsed YAML to find a secret key at any depth?: For each key in
secret_keys(), split the dotted path on.and navigate the parsed dict step by step. If the final value is a non-empty string that is not a keyring reference, report it as a plaintext leak. This replaces the current two-level loop. (proposed)- Chosen: Split-and-navigate each secret key. Uses the registry as the single source of truth. Handles any depth. Minimal change to the existing loop. Chosen.
- Rejected: Flatten the YAML to all dotted paths and check membership. Builds a full path list for every key in the file, then intersects with the registry. More work per file and does not scale if the file is large. Rejected.
- Rejected: Recursively walk the dict and match leaf names. Matches on the last segment of the path only, which can produce false positives when two sections share a leaf name. Rejected.
Open questions
- What value type counts as a plaintext secret in the scanner? (missing verified source)
- Does this fix depend on issue fix(config): the secrets audit never prints a config line it cannot parse, and an unparsable file is not reported clean #1022 (parse-error path in the same function)? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-04: partly.
Tool: Yelp/detect-secrets (https://github.com/Yelp/detect-secrets), Apache-2.0, last activity 2026-04-02, maintained.
Activity
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The scanner misses a known secret key because it only checks two-level dotted keys.A security audit reports compliant when a plaintext secret is present, but the gap is limited to one three-level key.Users who rely on audit-keys for compliance get a false pass for one credential path.The fix changes the scan loop to walk keys at every depth instead of hard-coding two levels.Both target _scan_yaml_for_secret_keys in config.py, but #1022 fixes a parse-error path while the candidate fixes the key-depth scan.docs(openspec): record the YAML errors and the leak path of audit-key…
docs(openspec): record the YAML errors and the leak path of audit-key…
docs(openspec): record the YAML errors and the leak path of audit-key…
devops-cli-service commentedon Oct 29, 2026
Refine cannot set this item to Ready at 0f7bc26 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.
fix(config): the audit-keys alert names the removal commands (#2663)
devops-cli-service commentedon Nov 4, 2026
Alternatives check: partly
Tool: Yelp/detect-secrets (https://github.com/Yelp/detect-secrets)
Covers:
private_keyvalue that is stored in the clearLacks:
secret_keys()registry as the source of truth for which dotted keys are managed credentialsdevops config audit-keysreport fields (plaintext_leaks,is_compliant,unaudited_config_files) or the command's exit codeservice.github_app.private_key, so a fake/non-PEM value could be missedSearches 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.
devops-cli-service commentedon Nov 5, 2026
Released in v0.57.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.57.0
devops-cli-service commentedon Nov 5, 2026
Live since 2026-11-05 00:12 UTC