Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

"Add support for secure token storage" #21

Open
samcoe opened this issue Mar 8, 2023 · 1 comment
Open

"Add support for secure token storage" #21

samcoe opened this issue Mar 8, 2023 · 1 comment

Comments

@samcoe
Copy link

samcoe commented Mar 8, 2023

Token storage change in latest release of gh

This is a message from the GitHub CLI team, maintainers of gh, writing to inform you that the most recent release of gh contains changes which may affect your extension. The latest release introduces the feature of storing authentication tokens in the system keyring (encrypted storage) instead of in a plain text file.
The keyrings that are supported are:

  • Keychain on macOS

  • GNOME Keyring on Linux (Secret Service dbus interface)

  • Wincred on Windows

This has huge security benefits for the users of our tool and was one of our oldest outstanding issues. Unfortunately this change has the potential to break extensions that rely on utilizing the users authentication token to work.

In order to have continued compatibility with gh there are some actions you, as an extension author, need to take. These actions will depend on the implementation of your extension.

Extensions built in Go using go-gh:

  1. Upgrade your go-gh version to v1.2.1, the latest version.

    • This can be done using go get github.com/cli/go-gh@v1.2.1
  2. Verify that in your extension retrieval of the user authentication token is done using the auth.TokenForHost function.

    • If you were previously accessing the authentication token using any other method it will no longer work.
    • Automatic resolution of the authentication token when using the API clients will continue to work without changes.

All other extensions:

  1. Verify that in your extension retrieval of the user authentication token is done by shelling out to the gh auth token command.

    • If you were previously accessing the authentication token using the gh config get command, reading the configuration file directly, or any other methods it will no longer work.

As of right now storing the authentication token in the system keyring is an opt-in feature, but in the near future it will be required and at that point if the changes above are not made then your extension will be broken for all users. If you have any questions/concerns about this change please feel free to open a discussion in the gh repo.

Thanks,
The GitHub CLI Team

@gabe565
Copy link
Owner

gabe565 commented Apr 4, 2023

Hey! Thank you, I appreciate the heads up. I'm working on adding support for secure tokens. I'll definitely be able to do it for regular gh profile switch calls, but I can't think of a way to implement this for the dir-based way, which updates the GH_CONFIG_DIR env. I have opened a discussion here cli/cli#7279

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants