Repository navigation
Description
Problem
devops config audit-keys fails open and can print the secret it is looking for. _scan_yaml_for_secret_keys (src/devops_cli/commands/config.py:495-515, at 79e1e93) parses each config file with yaml.safe_load. On a yaml.YAMLError it logs "Failed to parse config file %s for secrets audit: %s" with the error (:513-514) and returns [] (:515). PyYAML's error message quotes the offending line. No logging handler is configured in src, so Python's last-resort handler prints the warning to stderr. Reproduced offline twice: a malformed api_key: <value>: x line printed the value, and the file was reported with no plaintext secrets.
The audit also reads Path.cwd()/config.yaml and .devops/config.yaml, which load_settings need not parse first, so a malformed file there can show as "CLEAN (0 Plaintext)". Reviews flagged this through Semgrep's logger-credential-disclosure rule in S2 to S6, and a deterministic syntax check invalidated it each time because "Failed to parse" in the quoted log message reads as a syntax claim (.data/review-evaluation-20261002-s5.md, sections 3.3 and 6.3).
Acceptance criteria
- The parse-failure log carries the file, the error class and the line and column (
err.problem_mark), never the error message or the snippet. A test with a malformed line holding a fake key value asserts the value is not in stderr or the log records. - A file the audit cannot read or parse is reported as unaudited, not clean, and the command exits non-zero. A test asserts the exit code and the "unaudited" row.
-
--jsonoutput lists unaudited files separately from files with leaks. - Tests run offline in tmp directories and each runs well under 1 s.
-
changelog.d/1022.mdrecords the fix under### Security.CHANGELOG.mdis not edited. -
uv run devops cipasses.
Key questions
- Exit non-zero on an unparsable file? (proposed) Yes. An audit that cannot read a file has not shown it is clean; a zero exit would let a CI step pass on it.
- Should the review's syntax oracle stop invalidating findings that quote a log message? (proposed) Yes, but in fix(review): a correct refutation stands when the guard's evidence is a path token, a citation inside the finding's own lines, or generic scanner wording #1021's guard work or fix(review): the report ranks verified findings first, keeps only scanned advisories, and uses one category taxonomy and calibrated severity #948, not here. This item fixes the defect the finding pointed at.
Depends on: none.
Order: any time; touches only commands/config.py and its tests.
Related: #972 (config from the tree under review), #1000 (one Settings module).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 8, 2026
Placed in v0.2.30 on 2026-10-08 at the owner's request ("Populate 10 security and ci issues into each v0.2.30, v0.2.31, and v0.2.32 milestone"). This is a person's placement. Release theme: P1 secret and sandbox-boundary fixes, the review tools lock, kube-linter finding identity and a faster gate. Position 3 of 10 in the release's planned merge order. Its board Status is set to Ready, so the release-start fill keeps it.
fix(config): the secrets audit never prints a config line it cannot p…
fix(config): the secrets audit never prints a config line it cannot p…
dan-petty-bot commentedon Oct 9, 2026
What changed
#1461, merged into
release/v0.2.30as a6f8474.8 file(s) changed.
How it was verified
Check runs at 7dd9dad:
Acceptance Criteria of
docs/agent/tasks/task-1022-secrets-audit-unparsable-config.md:test_config_audit_keys_never_logs_an_unparsable_line(tests/test_config_audit_keys.py) assertsFAKE-1022-valueis in neither the output, stderr nor any log record, and that one record names the file,ScannerErrorandline 2, column 27.test_config_audit_keys_reports_an_unparsable_file_unaudited(table, noCLEAN (0 Plaintext)and no success line),test_config_audit_keys_reports_an_undecodable_file_unaudited(a non-UTF-8 file, logged with its error class and no position) andtest_config_audit_keys_reports_an_unconstructable_value_unaudited(an impossible date).--jsonlists unaudited files separately from leaks:test_config_audit_keys_json_lists_unaudited_files_apart_from_leaks._audit_in_tmp_dirfixture runs every audit intmp_path, so a developer's ownconfig.yamlis never scanned, and the tests only read and write files.changelog.d/1022.mdrecords the fix under### Security;CHANGELOG.mdis not edited.uv run devops cipasses: the PR's passing checks.feat(release): v0.2.30 (#1473)
fix(config): exit 1 when audit-keys finds a plaintext secret (#2401)
fix(config): a config file that is not valid YAML stops the load with…
fix(review): a review's scanners leave out the rules that never gave …