Skip to content

fix: auto-force file keyring when GOG_KEYRING_PASSWORD is set#1

Merged
Sheldenshi merged 2 commits intomainfrom
Sheldenshi/force-file-keyring-backend
Mar 20, 2026
Merged

fix: auto-force file keyring when GOG_KEYRING_PASSWORD is set#1
Sheldenshi merged 2 commits intomainfrom
Sheldenshi/force-file-keyring-backend

Conversation

@Sheldenshi
Copy link
Copy Markdown
Member

Summary

  • When GOG_KEYRING_BACKEND is auto (default) and GOG_KEYRING_PASSWORD is set, automatically force the file backend instead of letting the keyring library pick macOS Keychain
  • This prevents unexpected Keychain prompts in non-interactive environments (BabyClaw, CI, SSH)
  • Improved integration test to spy on keyringOpenFunc and assert AllowedBackends is [FileBackend]

Test plan

  • go test ./internal/secrets/... — all 33 tests pass
  • Unit tests cover 5 cases for shouldForceFileForPassword (auto+password, auto+empty, auto+unset, explicit file, explicit keychain)
  • Integration test verifies the config passed to keyring.Open has AllowedBackends: [FileBackend]

🤖 Generated with Claude Code

Sheldenshi and others added 2 commits March 19, 2026 17:14
When the backend is "auto" and GOG_KEYRING_PASSWORD is set, force the
file backend instead of trying Keychain/SecretService first. If someone
provides a keyring password, they clearly intend file-based storage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ends

The previous test only checked that OpenDefault() returned non-nil,
which would pass even if Keychain was used. Replace with a spy on
keyringOpenFunc that captures the Config and asserts AllowedBackends
contains only FileBackend.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Sheldenshi Sheldenshi merged commit 492cc0c into main Mar 20, 2026
4 of 8 checks passed
@Sheldenshi Sheldenshi deleted the Sheldenshi/force-file-keyring-backend branch March 20, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant