Skip to content

Secrets don't work when set via stdin #5031

Description

@HariSekhon

Describe the bug

Passing secrets to GitHub CLI via stdin results in the secrets causing authentication failures when used, while setting secrets with the --body switch works.

There must be some kind of bug in the non-interactive stdin passing.

Steps to reproduce the behavior

This works:

gh secret set "$key" --body "$value"

This results in unusable secrets causing authentication failures eg. for AWS CLI

gh secret set "$key" <<< "$value"
gh --version
gh version 2.4.0 (2021-12-21)
https://github.com/cli/cli/releases/tag/v2.4.0

Activity

  1. added
    priority-2Affects more than a few users but doesn't prevent core functions
    and removed on Jan 21, 2022
  2. vilmibm commented on Jan 21, 2022

    @vilmibm
    Contributor

    Confirmed:

    value=bar
    ghd secret set foo --body "$value"
    DBG "bar"
    ✓ Set secret foo for vilmibm/testing
    ghd secret set foo <<< "$value"
    DBG "bar\n"
    ✓ Set secret foo for vilmibm/testing

    We need to strip the \n when reading from STDIN.

  3. self-assigned this
    on Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority-2Affects more than a few users but doesn't prevent core functions

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions