Skip to content

fix(config): a config file that does not parse never prints its line from any command that loads settings #1468

Closed

Description

@dan-petty

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) calls yaml.safe_load on the global and project config files and lets a yaml.YAMLError propagate. 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_CONFIG pointing at a file containing ai:\n api_key: FAKE-value: x, devops config get ai.provider exits 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, catch yaml.YAMLError and raise the existing config error type naming the file and the problem's line and column (problem_mark), never the line's text, chained with from None so 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.provider against 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.provider against a file with a malformed line exits 1. The output names the file, line and column. No traceback appears.
    Verification: Set DEVOPS_CLI_CONFIG to a file containing ai:\n api_key: FAKE-value: x. Run devops config get ai.provider. Check exit code is 1, the message names the file and position, and no traceback or FAKE- value appears.

Key questions

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/security
    scope/security
    scope/config
    source/agent
    on Oct 9, 2026
  2. dan-petty-bot commented on Oct 9, 2026

    @dan-petty-bot
    Collaborator

    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.

    • Priority: P2-Medium. Local-only secret disclosure triggered by a malformed config file; no remote or network vector, but real credential leakage on a common error path.
    • Value: High. Prevents API keys and other secrets from being echoed to stderr, logs, or tracebacks whenever a config file has a syntax error.
    • Effort: Low. 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.
  3. dan-petty commented on Oct 26, 2026

    @dan-petty
    OwnerAuthor

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

    • Priority: P2-Medium. This issue affects security by potentially exposing secrets in error messages.
    • Value: High. Fixing config parsing to not expose secret values improves security for all users.
    • Effort: Medium. The fix requires modifying error handling in config loading code and adding tests.
    • Possible duplicate: fix(config): devops config audit-keys exits 1 when it finds a plaintext secret #1469, which may ask for the same change. The model names a config file that does not parse never prints its line from any command that loads settings as 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.
  4. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

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

  5. 2 remaining items

  6. added a commit that references this issue on Oct 28, 2026
  7. added
    priority/p2-medium
    status/ready
    effort/medium
    value/high
    on Oct 28, 2026
  8. 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/p2-mediumscope/configscope/securitysource/agenttype/securityvalue/high

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions