Repository navigation
Description
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:
- Use
ghnormally while the access token remains valid. - When the access token needs refreshing, prompt for Touch ID or an appropriate user-presence mechanism.
- After approval, refresh and continue normally.
- 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.
- [GitHub CLI macOS Keyring Security](https://github.com/cli/cli/blob/trunk/docs/macos-keyring.md)
- [Refreshable credential storage and refresh implementation](Refreshable tokens (2/7): refresher domain, OAuth refresher, storage, and wiring #14451)
- [Apple: accessing Keychain items with Face ID or Touch ID](https://developer.apple.com/documentation/localauthentication/accessing-keychain-items-with-face-id-or-touch-id)
Activity
cli-triage commentedon Nov 6, 2026
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/securityintegration 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
Duplicate analysis
Label reasoning
Investigation notes
Generated by issue triage.
github-actions commentedon Nov 6, 2026
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 wantedContributions 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.