Visitar URL original
Allow a shorter Refresh Token inactiviy lifetime and document Incident Response revocation · Issue #14967 · cli/cli · GitHub
Skip to content

Allow a shorter Refresh Token inactiviy lifetime and document Incident Response revocation #14967

Open

Description

@fproulx-boostsecurity

Describe the feature or problem you’d like to solve

Thank you for adding support for expiring, automatically refreshed credentials! This is a meaningful improvement over non-expiring access tokens.

GitHub documents that the refresh token expires after six months without use. Because a successful refresh rotates it, an actively used session can persist longer than six months. If the current refresh token is stolen, an attacker may be able to exchange it for a new token pair and continue refreshing it.

I’d be comfortable trading some convenience for a shorter inactivity window. For example, with a 10-day rolling inactivity limit, my CLI would keep working after a few days away, but I’d need to sign in again after a two-week vacation.

There is also an incident-response question: if I suspect malware ran on my laptop and accessed the refreshable credential, I want to know precisely how to revoke that credential server-side, including if the attacker has already exchanged the stolen refresh token for a new pair.

Proposed solution

1. Support a shorter, server-enforced refresh-token inactivity lifetime.

Allow a user or organization to request a shorter inactivity lifetime for GitHub CLI authentication. This would let users reduce the usable window for an unused stolen refresh token while retaining automatic refresh during normal use.

A separate absolute session lifetime could also be useful, but is not essential to this request.

A client-side timeout that deletes the local credential would improve local session hygiene, but it would not shorten the validity of a refresh token already copied by an attacker. Likewise, a rolling inactivity limit would not impose an absolute session limit if an attacker keeps using the credential.

I understand this lifetime appears to be controlled by GitHub’s OAuth platform, not by gh alone. Is there an existing platform capability for this? If not, could this request be routed to the appropriate team?

2. Document the incident-response procedure for refreshable credentials.

Please document how a user or security team should respond when they suspect the GitHub CLI access token or refresh token has been stolen, for example following a malware infection on a developer laptop.

In particular:

  • Does revoking GitHub CLI under Settings → Applications → Authorized OAuth Apps invalidate the current refresh token and any token pair an attacker obtained through a prior refresh?
  • Is there a supported way to revoke a single device’s credential or token family, rather than the GitHub CLI authorization across all devices?
  • Is there an API-supported procedure for revoking an OAuth app refresh token when its value is known? Does it work if the token has already been rotated?
  • What should responders expect from gh after revocation, and what evidence or security-log events, if any, can help investigate refresh-token theft or reuse?
  • Could gh auth logout or the authentication documentation point users to the server-side revocation procedure and explain its scope?

I understand that gh auth logout removes local authentication configuration and does not itself revoke tokens. Clear guidance would help responders contain an incident without mistaking local cleanup for server-side revocation.

Additional context

The GitHub CLI manual currently documents revoking the GitHub CLI OAuth app authorization and notes that this affects CLI authentication tokens across devices. More detail about rotating refresh tokens and incident response would be helpful.

A rejected refresh token could be a useful investigation signal if an attacker exchanged a stolen token before the legitimate CLI did. It would not, by itself, prove theft, and the absence of a failure would not rule out compromise.

Activity

  1. cli-triage commented on Nov 6, 2026

    @cli-triage

    GitHub CLI 2.103.3 already supports gh auth login --expiring, which asks the server for credentials that gh refreshes automatically. It does not expose a way to choose the refresh token's inactivity lifetime, and the server still decides what credential is issued.

    The current gh auth logout guidance says logout removes credentials locally and points to revoking the full GitHub CLI authorization across all devices. It does not explain single-device or token-family revocation after rotation. That leaves a clear platform capability request and a related authentication documentation gap for maintainers to evaluate.

    Supporting reports

    Generated by issue triage.

  2. deleted a comment from cli-triage on Nov 6, 2026
  3. added
    enhancementa request to improve CLI
    gh-authrelating to the gh auth command
    on Nov 6, 2026
  4. github-actions commented on Nov 6, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

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

    enhancementa request to improve CLIgh-authrelating to the gh auth command

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions