AUTO-UPDATED

GitHub CLI's New Expiring Tokens Still Leave Your Refresh Token Exposed to Malware

GitHub CLI has introduced short-lived access tokens to improve security, but the tool ghtkn offers enhanced protection by securing refresh tokens within an encrypted, passphrase-protected local daemon.

Key Points

  • GitHub CLI (gh) now uses short-lived access tokens that automatically refresh, though refresh tokens remain stored in the OS keyring.
  • The ghtkn CLI utilizes a local agent backend that encrypts refresh tokens with a user-defined passphrase, preventing unauthorized access by other processes.
  • Unlike the GitHub CLI, ghtkn allows users to restrict token access to specific organizations and repositories using GitHub App user access tokens.
  • The ghtkn agent can be manually locked to prevent token generation, and it provides alerts if a refresh token is potentially compromised.
  • ghtkn supports switching between multiple GitHub Apps with varying permission levels, reducing the risk associated with overly privileged tokens.

Why it Matters

While GitHub's move to short-lived tokens reduces the window of opportunity for attackers, storing refresh tokens in the OS keyring leaves them vulnerable to malware. The ghtkn tool provides a more robust security architecture for developers who require granular control over token permissions and protection against unauthorized credential extraction.
Hashnode.dev Published by Shunsuke Suzuki
Read original