Skip to content

Add flag to stop outputting of auth token in plain text #8237

Open

Description

@samcoe

Discussed in #8219

Originally posted by AdnaneKhan October 19, 2023
Curious if this is possible? In cases where someone is using the cli but does not need to retrieve the plaintext OAuth token it would be helpful to disable that functionality as a defense in depth measure

Maybe a flag that we can pass during login?

Activity

  1. added
    enhancement
    discuss
    gh-auth
    on Oct 23, 2023
  2. williammartin commented on Oct 23, 2023

    @williammartin
    Member

    It's an interesting idea for sure! So we'd need an approach which only allows setting some value through the binary, but not unsetting it, and it would need to also be safe from the shell unsetting it without some special permissions e.g. setting it in the plaintext config is probably not sufficient.

    Spitballing, perhaps we could set a keyring entry that we check before getting the token in gh auth token? Then the privilege level for setting this is the same as actually fetching the token?

  3. AdnaneKhan commented on Oct 24, 2023

    @AdnaneKhan

    It's an interesting idea for sure! So we'd need an approach which only allows setting some value through the binary, but not unsetting it, and it would need to also be safe from the shell unsetting it without some special permissions e.g. setting it in the plaintext config is probably not sufficient.

    Spitballing, perhaps we could set a keyring entry that we check before getting the token in gh auth token? Then the privilege level for setting this is the same as actually fetching the token?

    Another possibility could be allowing the user to set a password to encrypt the token itself. It could be a symmetric key derived from a password they enter upon auth (and this would be optional, with an encrypt token flag or similar). If the token is encrypted then the CLI will prompt for the password before performing operations. If the user forgets the password they can just re-auth to GitHub.

    This could solve the problem of leaving a very powerful token accessible to anyone able to run code in the context of the user.

  4. williammartin commented on Oct 24, 2023

    @williammartin
    Member

    Another possibility could be allowing the user to set a password to encrypt the token itself. It could be a symmetric key derived from a password they enter upon auth (and this would be optional, with an encrypt token flag or similar). If the token is encrypted then the CLI will prompt for the password before performing operations. If the user forgets the password they can just re-auth to GitHub.

    That's an interesting idea, with a symmetry to providing a password to use an ssh key. In those cases though, there's also the ability to add the identity for some extended period of time, as I imagine a lot of our users would want to do if they want both the security of the password and the convenience of not entering it every time during a heavy usage session.

  5. added
    discuss
    and removed
    discuss
    on Oct 31, 2023
  6. added
    needs-triage
    on Nov 25, 2024
  7. cli-triage commented on Jul 9, 2026

    @cli-triage

    This is a clear enhancement request asking for a flag on gh auth login (or related auth commands) to prevent outputting the OAuth token in plain text, framed as a defense-in-depth security measure. No duplicate issues were found after searching for related terms (token plaintext, hide/suppress token display, auth token output). The issue already carries the correct labels (enhancement and gh-auth), so no new labels are being suggested — it is already appropriately classified. The request is concise and understandable, though it could benefit from more detail about the exact UX flow desired (e.g., which command/flag would trigger the restriction, and whether this affects gh auth token retrieval as well as gh auth login display).

    Generated by Issue Triage (skills-driven) · 24.1 AIC · ⌖ 5.99 AIC · ⊞ 5K · ◷

  8. removed
    needs-triage
    on Jul 9, 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

    discussenhancementgh-auth

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions