Repository navigation
Closed
Labels
effort/mediumEffort Mediumpriority/p2-mediumPriority P2: standard workscope/configSettings, OS Keyring, environment variables, and defaultsscope/securitySecurity linters (trivy, bandit, gitleaks, kubeconform) and Vaultsource/agentFiled by an agenttype/securityType security: a vulnerability or a leakvalue/highValue High: the delivery of the item matters much
Description
Problem
Checked at release/v0.2.30 (edd2578). Follow-up to #1022, found by its review (PR #1461).
config/settings.py::_read_config_layers(:973-981) callsyaml.safe_loadon the global and project config files and lets ayaml.YAMLErrorpropagate. PyYAML's error message quotes the offending line with a caret.- So any command that loads settings prints that line on stderr, in the traceback or the error text. With
DEVOPS_CLI_CONFIGpointing at a file containingai:\n api_key: FAKE-value: x,devops config get ai.providerexits 1 and prints the line, value included. - fix(config): the secrets audit never prints a config line it cannot parse, and an unparsable file is not reported clean #1022 fixes this only for
devops config audit-keys, which now reports an unparsable file without printing its lines. Every other entry point still prints them. A malformed line is exactly where a pasted secret tends to be.
Proposed remedy
- In
_read_config_layers, catchyaml.YAMLErrorand raise the existing config error type naming the file and the problem's line and column (problem_mark), never the line's text, chained withfrom Noneso the traceback doesn't carry it either.
Acceptance criteria
- A test loads settings from a file whose bad line holds a
FAKE-value and asserts the error names the file, line and column and that neither stdout, stderr nor the exception chain contains the value. -
devops config get ai.provideragainst that file exits 1 with that message and no traceback.
Proposed design
Problem statement
The config loader in _read_config_layers calls yaml.safe_load and lets a yaml.YAMLError propagate. PyYAML's error message quotes the offending line, which may hold a secret. Every command that loads settings prints that line on stderr. Issue #1022 fixed this only for devops config audit-keys. All other entry points still expose the line's text.
Acceptance criteria
- Criterion 1: A test loads settings from a file whose bad line holds a
FAKE-value. The test asserts the error names the file, line and column. The test asserts neither stdout, stderr nor the exception chain contains the value.
Verification: Run the new test. It passes and the assertions on stdout, stderr and the exception chain all hold. - Criterion 2:
devops config get ai.provideragainst a file with a malformed line exits 1. The output names the file, line and column. No traceback appears.
Verification: SetDEVOPS_CLI_CONFIGto a file containingai:\n api_key: FAKE-value: x. Rundevops config get ai.provider. Check exit code is 1, the message names the file and position, and no traceback orFAKE-value appears.
Key questions
- What is the name of the existing config error type to raise in place of the raw
yaml.YAMLError?: The issue names it as "the existing config error type." Theaudit-keysfix in fix(config): the secrets audit never prints a config line it cannot parse, and an unparsable file is not reported clean #1022 already handlesyaml.MarkedYAMLErroratsrc/devops_cli/commands/config.py:613. The implementer must find the custom config exception defined in the config module and raise it with the file path, line and column fromproblem_mark, chained withfrom None. [sources: src/devops_cli/config/settings.py:1097, src/devops_cli/commands/config.py:613] - Is fix(config): devops config audit-keys exits 1 when it finds a plaintext secret #1469 a duplicate of this issue?: Intake flagged fix(config): devops config audit-keys exits 1 when it finds a plaintext secret #1469 as a possible duplicate and deferred the decision to a person. Both issues fix the same problem of config parsing errors printing lines with secrets. A person must close one of the two before delivery. (proposed)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
effort/mediumEffort Mediumpriority/p2-mediumPriority P2: standard workscope/configSettings, OS Keyring, environment variables, and defaultsscope/securitySecurity linters (trivy, bandit, gitleaks, kubeconform) and Vaultsource/agentFiled by an agenttype/securityType security: a vulnerability or a leakvalue/highValue High: the delivery of the item matters much
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsNew
Activity
dan-petty-bot commentedon Oct 9, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
Local-only secret disclosure triggered by a malformed config file; no remote or network vector, but real credential leakage on a common error path.Prevents API keys and other secrets from being echoed to stderr, logs, or tracebacks whenever a config file has a syntax error.The fix is a single catch block in '_read_config_layers' that re-raises a config error with file/line/column but not the line text, plus one test.dan-petty commentedon Oct 26, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
This issue affects security by potentially exposing secrets in error messages.Fixing config parsing to not expose secret values improves security for all users.The fix requires modifying error handling in config loading code and adding tests.a config file that does not parse never prints its line from any command that loads settingsas the change that both ask for.Both items fix the same problem of config parsing errors printing lines with secrets.A person closes one of the two if that is so.dan-petty commentedon Oct 28, 2026
Status set to Ready at d509dba (see proposed design in issue body).
docs(openspec): plan the config load error that quotes no file text
test(config): expect a config file that is not valid YAML to stop the…
2 remaining items
docs(openspec): name #2451 for the config paths that do not load the …
test(config): expect audit-keys to report a config file that the YAML…
fix(config): devops config audit-keys refuses each error of the YAML …
refactor(config): settings resolve in one declared order through pyda…
test(config): expect audit-keys to report a config file that the YAML…
fix(config): devops config audit-keys refuses each error of the YAML …
test(config): expect audit-keys to report a config file that the YAML…
fix(config): devops config audit-keys refuses each error of the YAML …
fix(config): devops config audit-keys scans each config file that the…