Skip to content

Support optional Touch ID or user-presence protection for refreshable credentials on macOS #14969

Open

Description

@fproulx-boostsecurity

Describe the feature or problem you’d like to solve

The new refreshable OAuth credentials reduce the lifetime of a leaked access token, but gh still needs to retain a refresh token that can obtain new credentials.

On macOS, gh uses Keychain through zalando/go-keyring. The CLI’s [macOS Keyring Security notes](https://github.com/cli/cli/blob/trunk/docs/macos-keyring.md) explain that this invokes /usr/bin/security and that direct calls to security can also access stored gh tokens, subject to Keychain access controls. This makes the refresh credential an interesting target for malicious code running in a developer’s user session.

Could gh offer an optional user-presence requirement, such as Touch ID, to protect refreshable credentials?

Proposed solution

Provide an opt-in macOS credential-storage mode that requires user presence before accessing the refresh token or performing a token refresh.

My preferred experience would be:

  1. Use gh normally while the access token remains valid.
  2. When the access token needs refreshing, prompt for Touch ID or an appropriate user-presence mechanism.
  3. After approval, refresh and continue normally.
  4. In non-interactive environments, fail with a clear message rather than hanging indefinitely.

An optional, bounded authentication reuse period could make this practical for frequent commands. The current behavior could remain available for unattended workflows.

This would give users a way to make access to the refresh credential require local user participation, while preserving normal CLI use between refreshes.

Additional context

The current implementation stores access and refresh information together, so prompting only for refresh may require a different storage design. I also understand that changing the macOS Keychain integration has distribution and code-signing tradeoffs, including for Homebrew builds.

I’d appreciate maintainers’ thoughts on:

  • Whether macOS Keychain APIs can provide this behavior for gh’s distribution model.
  • Whether access and refresh credentials could be protected separately.
  • How to support CLI extensions, headless sessions, and a configurable authentication reuse period.
  • Whether another credential broker or platform-native mechanism would be a better fit.

Touch ID would be a local access-control improvement, not a guarantee that an extracted bearer token is device-bound. A process that obtains an access token after approval could still copy it.

Activity

  1. cli-triage commented on Nov 6, 2026

    @cli-triage

    This is a clear request for an optional macOS security mode. GitHub CLI 2.103.3 does not document a way to require Touch ID or other user presence before reading or refreshing stored credentials. Its macOS keyring notes describe the current /usr/bin/security integration and the code-signing and distribution tradeoffs of native Keychain APIs.

    The requested flow would add behavior beyond current support, especially separate protection for refresh credentials and clear failure in non-interactive sessions. Those details provide enough scope for maintainers to evaluate the design and distribution impact.

    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