Skip to content

gh auth status gives no indication of Keychain-stored OAuth token, making full de-authorization non-obvious #13330

Closed

Description

@ruyrocha

Describe the bug

gh auth status reports SSH as the configured protocol for git operations, and hosts.yml contains no token. This creates a false impression that removing SSH keys and revoking PATs is sufficient to de-authorize a machine. In reality, gh stores its OAuth token (gho_*) silently in the system Keychain under gh:github.com, which survives all of those steps.

A user who wants to fully revoke local access has no visible indicator that the Keychain entry exists or that gh auth logout is the only reliable way to remove it.

Affected version

It's designed this way since 2023 (v2.32.1 specifically).

Steps to reproduce the behavior

  1. Run gh auth login with SSH as the git protocol
  2. Confirm hosts.yml has no oauth_token field - only user/protocol metadata
  3. Revoke all PATs at github.com/settings/tokens
  4. Remove SSH keys from ~/.ssh/
  5. Run gh gist list or any API-backed command
  6. Observe that it still authenticates successfully

Expected vs actual behavior

Expected: Either gh auth status surfaces the Keychain-stored token clearly (e.g. ✓ Token stored in: system keychain (gh:github.com)), or the security log / PAT revocation flow warns that a separate CLI OAuth token may still be active on the machine.

Actual: The token is invisible to the user. gh auth status only shows Token: gho_**** without indicating where it comes from. Nothing in GitHub's security UX (PAT revocation, SSH key removal, hosts.yml inspection) reveals the token or prompts the user to revoke it via gh auth logout.

Logs

❯ cat ~/.config/gh/hosts.yml
github.com:
    git_protocol: ssh
    users:
        ruyrocha:
    user: ruyrocha

❯ security find-generic-password -s "gh:github.com" -w
go-keyring-base64:[TOKEN]

❯ gh gist list | head -1
# still works after removing SSH keys and revoking all PATs

Related issues

Activity

  1. added
    needs-triage
    on May 2, 2026
  2. williammartin commented on May 2, 2026

    @williammartin
    Member

    Hey, thanks for the report. Can you share your gh auth status in the case whee you're not seeing any indication of the keyring?

    ➜ gh auth status
    github.com
      ✓ Logged in to github.com account williammartin (keyring) <------ keyring
      - Active account: true
      - Git operations protocol: ssh
      - Token: gho_************************************
      - Token scopes: 'gist', 'read:org', 'read:project', 'repo', 'workflow'
    

    Open to discussing ways to make something like this clearer (like putting it by the token), but just from your report I can't tell whether you missed this or there's something strange going on.

  3. added
    more-info-needed
    on May 2, 2026
  4. zahraazizi5856-art commented on May 3, 2026

    @zahraazizi5856-art
  5. ruyrocha commented on May 4, 2026

    @ruyrocha
    Author

    hey @williammartin looks like the issue was solved already, so I'm closing this. Thank you for the inputs here!

  6. removed
    needs-triage
    more-info-needed
    on May 4, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions