Skip to content

Fix/secret store cross platform#3

Merged
GregKinne merged 2 commits into
feat/oss-secret-storefrom
fix/secret-store-cross-platform
Jul 7, 2026
Merged

Fix/secret store cross platform#3
GregKinne merged 2 commits into
feat/oss-secret-storefrom
fix/secret-store-cross-platform

Conversation

@GregKinne

Copy link
Copy Markdown
Owner

No description provided.

Gregory Kinne added 2 commits July 7, 2026 12:13
Three minimalist bug fixes for the secret store introduced in PR #2:

1. _ensure_backend: catch ImportError when secret_store_backends is
   unimportable (Windows has no fcntl module). The consolidated macOS
   backend is irrelevant off macOS anyway.

2. _write_fallback: use hasattr(os, 'fchmod') guard and fall back to
   os.chmod on the path. os.fchmod is POSIX-only and raises
   AttributeError on Windows, which the existing except OSError would
   not catch.

3. set_secret: when the keyring backend is healthy but the write fails
   (transient error, dismissed Keychain prompt, etc.), warn instead of
   silently writing to the fallback file. The old behavior stranded the
   secret because get_secret skips the fallback when keyring_available()
   is True.

Tests added for all three cases.
The fallback path exists for environments without a keyring (headless
Linux, CI, Windows). Using os.chmod instead of os.fchmod removes the
hasattr guard from the prior commit — one cross-platform call instead
of a branching shim. Simpler test, same behavior.
@GregKinne
GregKinne merged commit dc7fb73 into feat/oss-secret-store Jul 7, 2026
@GregKinne
GregKinne deleted the fix/secret-store-cross-platform branch July 7, 2026 16:33
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