Skip to content

feat(config): devops config set stores a multi-line secret, such as a pem private key, from a file or stdin, never from argv or a one-line prompt #1649

Closed

Description

@dan-petty

Friction

Evidence

Checked at main 3dd7fa6.

  • _value_or_prompt (src/devops_cli/commands/config.py:173-183) returns the argv value or typer.prompt(..., hide_input=True), which reads one line.
  • dotted_set (src/devops_cli/config/settings.py:1294-1302) writes a key to the keyring only when it is in _SECRET_FIELDS (settings.py:103, from SECRET_CONFIG_OPTIONS at src/devops_cli/config/options.py:228). Any other key is a plain setting or an error.
  • The cluster push reads keyring values through KeyringSource (src/devops_cli/k8s/cluster_secrets.py:34), so a multi-line value stored correctly reaches a Kubernetes Secret unchanged.
  • Nothing under src/ reads a secret from a file or from stdin today.

Remedy

  • devops config set <secret-key> --from-file <path> reads the value from the file, and --from-file - reads stdin until EOF. The value never appears in argv, in output or in logs.
  • The option is accepted only for keys in _SECRET_FIELDS. For any other key, or together with a positional value, it exits 2 with a message naming the problem.
  • The file is read as text, one trailing newline is kept as the file has it, and an empty value is refused.
  • Size is capped (a constant in config/constants.py, well above a 4096-bit PEM key), so a wrong path cannot load a large file into the keyring.
  • The help text and the configuration docs show the PEM case.
  • Priority under the owner's blocker rule (2026-10-17): P0 if the GitHub App identity item is filed (D2 = A), because it blocks that P0 item. Otherwise no rule-driven raise: its other dependent, feat(k8s): argo cd records each single-source github application's deploy outcome as a github deployment on the synced commit, through its own deployments-only github app #1387, has no priority label.

Acceptance criteria

  • Tests first, offline, with an in-memory keyring:
    • a three-line PEM-shaped value from a tmp_path file and from stdin is stored byte for byte;
    • --from-file with a non-secret key, with a positional value, with an empty file and with an oversize file each exit 2 and store nothing;
    • the value appears in no captured output.
  • devops docs generate --sync-readme output is committed, and devops docs check passes.
  • uv run devops ci passes.

Related

Proposed design

Problem statement

The current devops config set command only supports single-line secret inputs via command-line arguments or a one-line hidden prompt. This is insecure and inadequate for multi-line secrets like PEM private keys, which are commonly needed for GitHub App identities and Argo CD deployments.

Acceptance criteria

  • Criterion 1: A three-line PEM-shaped value from a file is stored byte for byte in the keyring
    Verification: Run offline tests with an in-memory keyring that verifies the exact bytes of a multi-line secret read from a temporary file
  • Criterion 2: A multi-line secret from stdin is stored byte for byte in the keyring
    Verification: Run offline tests with an in-memory keyring that verifies the exact bytes of a multi-line secret read from stdin
  • Criterion 3: Using --from-file with a non-secret key exits 2 and stores nothing
    Verification: Execute devops config set regular-key --from-file /tmp/test and confirm exit code 2 with no value stored
  • Criterion 4: Using --from-file together with a positional value exits 2 and stores nothing
    Verification: Execute devops config set secret-key test-value --from-file /tmp/test and confirm exit code 2 with no value stored
  • Criterion 5: Using --from-file with an empty file exits 2 and stores nothing
    Verification: Create an empty file, run devops config set secret-key --from-file /tmp/empty, and confirm exit code 2 with no value stored
  • Criterion 6: Using --from-file with an oversize file exits 2 and stores nothing
    Verification: Create a file larger than the defined size limit, run devops config set secret-key --from-file /tmp/large, and confirm exit code 2 with no value stored
  • Criterion 7: The secret value appears in no captured output
    Verification: Run command with --from-file and check that no part of the secret appears in stdout, stderr or logs
  • Criterion 8: The generated documentation includes help text for the new --from-file option
    Verification: Run devops docs generate --sync-readme and verify that the help text for config set includes examples with --from-file
  • Criterion 9: Running devops docs check passes
    Verification: Execute devops docs check after generating documentation and confirm all checks pass
  • Criterion 10: A changelog fragment exists for the issue
    Verification: Confirm that a file named changelog.d/1649.md exists with appropriate content describing the feature
  • Criterion 11: Running uv run devops ci passes
    Verification: Execute the CI pipeline and confirm all checks pass including unit tests for the new functionality

Key questions

  • What is the maximum size allowed for files read by --from-file?: The size is capped by a constant in config/constants.py, well above a 4096-bit PEM key. [sources: src/devops_cli/config/constants.py]
  • Which keys are considered secret fields that can use --from-file?: Only keys in _SECRET_FIELDS, which is derived from SECRET_CONFIG_OPTIONS in src/devops_cli/config/options.py. [sources: src/devops_cli/config/settings.py:104, src/devops_cli/config/options.py:228]
  • How does the command handle reading from stdin when --from-file - is specified?: When --from-file - is used, it reads from stdin until EOF. [sources: src/devops_cli/commands/config.py:173-183]
  • What happens if someone tries to use --from-file with a non-secret key?: The command exits 2 with an error message naming the problem. [sources: src/devops_cli/commands/config.py:180]
  • What happens if someone tries to use --from-file together with a positional value?: The command exits 2 with an error message naming the problem. [sources: src/devops_cli/commands/config.py:197]
  • How does the file reading process handle trailing newlines?: The file is read as text, one trailing newline is kept as the file has it. [sources: src/devops_cli/commands/config.py:173-183]
  • How does the command validate that a file is not empty?: An empty value is refused, so the command will exit 2 if an empty file is provided. [sources: src/devops_cli/commands/config.py:173-183]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    on Oct 18, 2026
  2. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

    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.

    • Type: type/feature. The candidate adds a new feature to read secrets from files or stdin.
    • Priority: P1-High. It is required by a P0 item (the roadmap jobs' App identity) and blocks other dependent items.
    • Value: High. It enables secure handling of multi-line secrets like PEM keys, which is critical for security and functionality.
    • Effort: Medium. The change involves adding new command-line options, file reading logic, validation, and tests, but does not fundamentally alter the system architecture.
  3. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

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

  4. added a commit that references this issue on Oct 23, 2026
    a1a3fac
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

    source/agenttype/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions