Skip to content

fix(k8s): name --from-file in the push hint of a multi-line key #7435

Done

Description

@dan-petty

Problem Description

When a push has no value for a key of a managed credential, devops k8s push-secrets names the store command devops config set <option> (_store_hint, src/devops_cli/k8s/secret_push.py). For a multi-line credential, such as a PEM key or an OpenSSH private key, that command with no --from-file reads the value at a hidden prompt (typer.prompt(..., hide_input=True) in _value_or_prompt, src/devops_cli/commands/config.py), which reads one line. So a person who follows the hint stores only the first line of the key. The credentials of this form are service.github_app.private_key, renovate.github_app_private_key, argocd.github_app_private_key and infra.ssh_private_key (#7428).

Reproduction Steps

  1. Run uv run devops k8s push-secrets --plan --only devops/infra-ssh-key with no keyring value infra_ssh_private_key and no live Secret (after fix(infra): push-secrets has no row for the infra-drift SSH key #7428).
  2. Read the warning: store it with devops config set infra.ssh_private_key.

Expected vs Actual Behavior

Expected: for a multi-line credential, the hint names devops config set <option> --from-file <key-file>, as k8s/README.md (Cluster Secrets) does.
Actual: the hint names devops config set <option>, whose hidden prompt takes one line.

Environment Diagnostics

devops-cli 0.226.0, read in the source of main on 2026-11-27.

Logs, Traces, or Terminal Output

devops/infra-ssh-key id_ed25519: keyring infra_ssh_private_key is empty and devops/infra-ssh-key id_ed25519 holds no value; store it with devops config set infra.ssh_private_key

Source

Source: #7434

Alternatives check of 2026-11-27: none.
Tool: none found.
Reason: Searches found only unrelated documentation pages and no tool or library for this. The need is an internal change to the hint text that _store_hint prints, so no external tool covers it.

Lacks:

  • A hint naming --from-file for multi-line credentials
  • A per-option flag that marks a value as multi-line
  • Store commands that accept a key file instead of a hidden one-line prompt

Proposed design

Problem statement

The push hint for an empty keyring credential always names devops config set <option>. That command reads one line at a hidden prompt. A person who follows the hint for a multi-line private key stores only the first line. The fix makes the hint name --from-file <key-file> for the four multi-line credentials. It keeps the current hint for single-line credentials.

Acceptance criteria

Requirement: Multi-line source hint

_store_hint SHALL append --from-file <key-file> to the store hint of a keyring source whose multi_line flag is true.

Scenario: Multi-line keyring source

  • WHEN a test calls _store_hint with a KeyringSource for infra.ssh_private_key and multi_line=True
  • THEN the returned string is "; store it with devops config set infra.ssh_private_key --from-file <key-file>"

Requirement: Single-line source hint

_store_hint MUST keep the store hint of a keyring source whose multi_line flag is false unchanged.

Scenario: Single-line keyring source

  • WHEN a test calls _store_hint with a KeyringSource for example.token and multi_line=False
  • THEN the returned string is "; store it with devops config set example.token"

Requirement: Private-key rows marked multi-line

The cluster Secret table MUST set multi_line=True on the KeyringSource of each of the four private-key credentials.

Scenario: Private-key source flags

  • WHEN a test reads CLUSTER_SECRETS and collects the KeyringSource rows for service.github_app.private_key, renovate.github_app_private_key, argocd.github_app_private_key and infra.ssh_private_key
  • THEN each collected source has multi_line set to True

Requirement: Missing private-key message

The missing-value message for a multi-line keyring credential MUST include the file-based store hint.

Scenario: Missing infra SSH key

  • WHEN a test calls _missing_hint for the infra.ssh_private_key entry with an empty keyring and no live Secret
  • THEN the message contains "; store it with devops config set infra.ssh_private_key --from-file <key-file>"

Existing Tool Considered

The alternatives check in the issue body records the verdict none and Tool: none found; no open, maintained tool or library covers this internal hint text. The proposal adds the multi_line flag and the file hint. devops config set already accepts a key file. The written cost is about 400 tokens and under one hour to build and test; the code has no ongoing fix cost.

Key questions

  • Why does the current hint store only the first line of a private key?: _value_or_prompt reads a value with typer.prompt(..., hide_input=True), which returns one line. set_value already has a --from-file option that calls _secret_from_file and read_secret_input for the full text. [sources: src/devops_cli/commands/config.py:214, src/devops_cli/commands/config.py]
  • How should _store_hint know that a credential is multi-line?: Add a multi_line boolean field to KeyringSource, default False, and set it on the four private-key rows. _store_hint appends --from-file <key-file> when the field is true. (best practice) [sources: src/devops_cli/k8s/secret_push.py:344, src/devops_cli/k8s/cluster_secrets.py, src/devops_cli/commands/config.py]
    • Chosen: Add a multi_line flag to KeyringSource. The table already declares each credential source, so the flag stays next to the key and avoids a second hard-coded list.
    • Rejected: Keep a constant set of option names in secret_push.py. It duplicates table data and a new multi-line key can be missed.
    • Rejected: Detect multi-line from the option name. A name heuristic is brittle and does not state the fact.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor
  2. added
    type/bug
    scope/k8s
    source/agent
    status/new
    value/medium
    effort/low
    priority/p2-medium
    on Nov 27, 2026
  3. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (5)

    Searches run:

    • python CLI store multi-line secret from file option instead of prompt, results: 5
    • typer prompt hidden input multi-line value reads only first line, results: 5
    • questionary multiline text prompt python library, results: 5
    • typer.prompt hide_input documentation prompt parameter, results: 5
    • devops-cli k8s cluster secrets config set from-file, results: 5

    Sources:

  4. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  5. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  6. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 28, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  8. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 00:41 UTC

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/lowpriority/p2-mediumscope/k8ssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions