You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add flag to stop outputting of auth token in plain text #8237
discussFeature changes that require discussion primarily among the GitHub CLI teamenhancementa request to improve CLIgh-authrelating to the gh auth command
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
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?
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.
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.
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).
discussFeature changes that require discussion primarily among the GitHub CLI teamenhancementa request to improve CLIgh-authrelating to the gh auth command
Activity
williammartin commentedon Oct 23, 2023
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?AdnaneKhan commentedon Oct 24, 2023
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.
williammartin commentedon Oct 24, 2023
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.
feat: use gh-doctor oauth app to authenticate
cli-triage commentedon Jul 9, 2026
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 (enhancementandgh-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 affectsgh auth tokenretrieval as well asgh auth logindisplay).