stripe-cli
stripe-cli copied to clipboard
Storing livemode keys in macOS keychain not working with binary release for arm64
Issue
According to DX7509, the livemode credentials are supposed to be saved in the macOS keychain. This does not work with the binary release for arm64 or when installing via homebrew. Instead, it seems like the library being used for storing credentials (https://github.com/99designs/keyring) is selecting a different 'file' credential backend by default:
❯ stripe customers list --live
No directory provided for file keyring
When compiling from source, I get the confirmation pop-up as expected and have to allow access to the keyring. After this, all live commands work as expected:
Instead of the mac-os_arm64 binary I also tried using the mac-os_x86_64 binary, there the keychain is working as expected. My guess is, that something is misconfigured with the cross-compilation. Specifically with the cgo support, which seems to be enabled for amd64 but not for arm64. 99designs/keyring is requiring cgo for the keychain to work.
Expected Behavior
I expect the stripe binary installed via brew on arm64 to prompt me keychain access when first accessing/storing credentials. Currently, the only workaround seems to be to manually provide an API key whenever accessing the live environment.
Steps to reproduce
On an Apple Silicon Mac.
- Install stripe via homebrew, alternatively use the arm64 binary release:
brew install stripe/stripe-cli/stripe
- After logging in, execute any command in live mode:
❯ stripe customers list --live
No directory provided for file keyring
- Download and extract the amd64 binary. Execute any command in live mode using this binary. If not allowed yet, a keychain dialog will pop up and prompt to enter the password, the command will succeed as expected:
❯ ./stripe customers list --live
{
"object": "list",
"data": [
...
],
"has_more": true,
"url": "/v1/customers"
}
Environment
stripe: 1.10.4 compile: go1.19 darwin/arm64 with cgo enabled
@friedemannf thank you for the bug report and investigation! please bear with the workaround as i root cause fix it. thanks!
Hi, I’m unfortunately still seeing the same on a headless instance of Ubuntu 22.10 installed both via APT and manually.
Still happening on WSL, a quick fix is to run the following: sudo apt install gnome-keyring
sudo apt install gnome-keyring
did not fix the problem on WSL2 Ubuntu
./stripe listen --live
No directory provided for file keyring
this is after successful ./stripe login