Repository navigation
Open
Labels
enhancementNew feature or request
Description
Problem
On macOS, a login saved in the keychain (the default credential store) can ask for the keychain password several times during one command, and again after every upgrade. Linux Secret Service and Windows Credential Manager do not show this behavior.
The macOS Keychain gives each item an access list of trusted apps and asks for approval when a binary that is not on it reads the item. Three things cause the repeated prompts:
- Each command reads the secret more than once. Each
Resolver::resolve(src/auth.rs) reads the keychain again, and nothing caches the secret in the process. One command can resolve several times: a picker, the wallet currency lookup (src/wallet_currency.rs), the wallet shortlist (src/wallet_shortlist.rs), and the API call. A login refresh adds a second read under the lock and a write. If the user selects "Allow" instead of "Always Allow", each read prompts. - The release binaries are not codesigned with a Developer ID. The keychain then identifies the binary by its code hash, so every upgrade is a new app, and "Always Allow" is lost.
- Each command reads the keychain, even when the access token is still valid.
Fixes
- Read each secret at most once per process. Cache the secret in
Settingsafter the first read, and update the cache on a write or delete. This gives at most one prompt per command. - Codesign and notarize the macOS release binaries with a Developer ID. The keychain then trusts the team signature, so one approval lasts across upgrades. This needs an Apple Developer ID certificate in CI. It also removes the Gatekeeper warning on downloads.
- (Optional) Read the keychain only to refresh. Keep the refresh token in the keychain and cache the short-lived access token in an owner-only file. Do this only if prompts continue after the two fixes above.
- (Low priority) Do not read the keychain a second time under the refresh lock. The cache from the first fix makes this read free.
Workaround
Select Always Allow at the prompt, or log in with voltage login --credential-store file. The file store keeps the secret in an owner-only file under the configuration directory.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
fix(config): read each saved secret once per command (#117)