Skip to content

1password support as option to keep tokens securely - #14908

Closed
ilyaro wants to merge 3 commits into
cli:trunkfrom
ilyaro:chkp-trunk
Closed

ilyaro wants to merge 3 commits into
cli:trunkfrom
ilyaro:chkp-trunk

Conversation

@ilyaro

@ilyaro ilyaro commented Nov 2, 2026

Copy link
Copy Markdown

Releated to #5961

Description

Added support of 1password to save tokens and refresh tokens, instead of the default location
gh auth login --op

For security reasons and In corporates especially, it is very important to access the gh token in a secured way
We started to work like this, any time we need to access gh token, we use Fingerprint to get it from 1password

This way it is not possible to get the token freely when it saved in keychain, and any plugin of VScode or any code running on the machine can get it

We build the gh on MAC (we work on MAC only, not tested on Win or Linux) and now use it always like this

So the code is saving tokens in 1Password instead of keychain if --op flag is given, and makes it the default
Reads the tokens from 1Password and refreshes them to 1Password only
-->

How did you test this change?

I use the 1password supported gh I build for 2 weeks now and used it on 2 MAC laptops
I use it in everyday work in production with EMU and non EMU organizations at work

gh --version
gh version 0.0.4-fix-recreate-op-records-if-deleted (2026-10-28)
https://github.com/cli/cli/releases/latest

gh auth status
github.com
✓ Logged in to github.com account ilya_xxxxxx (1password)

  • Active account: true
  • Git operations protocol: https
  • Token: gho_************************************
  • Expiring token that gh refreshes automatically
  • Token expires: 2026-11-03T00:20:17Z (in about 8 hours)
  • Refresh token expires: 2027-05-02T16:20:16Z (in about 6 months)
  • Token scopes: 'gist', 'read:org', 'repo', 'workflow'
image image

Key points

I work with it only on MAC, but as GH owner in my company the idea is all users will use it in the company
And even it will be the default option for all users

Authorship and follow-up

Who wrote this:

  • [V] A human wrote it.

Who answers review comments:

  • [V] @ilyaro will read and reply directly.

@ilyaro
ilyaro requested a review from a team as a code owner November 2, 2026 16:39
@ilyaro
ilyaro requested a review from babakks November 2, 2026 16:39
@github-actions github-actions Bot added external pull request originating outside of the CLI core team needs-triage needs to be reviewed unmet-requirements and removed needs-triage needs to be reviewed labels Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for your pull request! This is a large change (1301 lines across 19 files) that doesn't reference a help wanted issue.

Large feature PRs require prior discussion in an issue before implementation — this helps the team assess whether the feature aligns with the project's direction before significant effort is invested.

Please open an issue to discuss this feature first. This PR will be automatically closed in 2 days if requirements are not met.

Full contribution requirements
  1. Include a detailed description of what this PR does
  2. Link to an issue with the help wanted label (use Fixes #123 or Closes #123)

@williammartin

Copy link
Copy Markdown
Member

You should file a new issue with your use case.

Couple of random drive by thoughts:

  1. You could probably achieve a lot of this with alias gh = GH_TOKEN=$(op ...) gh
  2. If we were going to accept something like this I think it would probably make more sense for it to be extensible like git credential helper protocol to support other backends than 1password

@BagToad

BagToad commented Nov 2, 2026

Copy link
Copy Markdown
Member

Thanks for the work you've put into this, @ilyaro.

Adding to Will's thoughts, I don't think we should couple gh's authentication to a specific password manager. This reaches beyond storing a token: login, token refresh, logout, and error handling would all carry 1Password-specific behavior for us to maintain.

A more general interface could avoid that coupling, but it brings its own challenges. We'd need to work through the security implications of delegating credential handling to external programs, including how access is authorized and failures are handled. That needs a design discussion across different stores and platforms before we commit to supporting an interface.

I'm going to close this PR rather than ask you to keep investing in an implementation before we've agreed on an approach. As Will suggested, please open an issue describing your use case so we can discuss the requirements separately from this implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team unmet-requirements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants