feat(secrets): S5 — keyring-backed secrets login with WSL2 env-var fallback (spec 04) - #59
Merged
Merged
Conversation
…fallback (spec 04) Completes M4's S5. Adds `internal/secrets/keyring.go`: - `Keyring` interface + `OSKeyring` (zalando/go-keyring: Secret Service / Keychain / Credential Manager, namespaced "devstack") + `MemKeyring` fallback; - `KeyringAvailable` probes by round-tripping a sentinel — any failure (notably WSL2 without D-Bus) → false; - `CredentialFor` resolves a provider credential in spec order: explicit env (`DEVSTACK_<PROVIDER>_TOKEN`) → managed keyring entry → "" (provider-native default). Providers (S3/S4) will consume this. CLI: real `secrets login|logout|status` (replacing the stub). `login` stores a credential via `--token`; on a keyring-less host it DEGRADES — warns, names the env var to set, exits 0 (tool keeps working). `status` reports keyring availability + per-provider source (env|keyring|none). An `openKeyring` seam makes both branches deterministically testable. All new deps (go-keyring, godbus, wincred) are pure-Go → CGO_ENABLED=0 build intact. govulncheck: only local go1.26 stdlib advisories (N/A to CI's Go 1.25.x); no module-level findings against the new deps. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Completes M4's S5: keyring-backed provider credentials with a clean WSL2 degrade path.
How
internal/secrets/keyring.go:Keyringinterface +OSKeyring(zalando/go-keyring — Secret Service / Keychain / Credential Manager, namespaceddevstack) +MemKeyringin-process fallback.KeyringAvailableprobes by round-tripping a sentinel; any failure (notably WSL2 without D-Bus) → false.CredentialFor(k, provider)resolves in spec-04 order: explicit env (DEVSTACK_<PROVIDER>_TOKEN) → managed keyring entry →""(provider-native default). S3/S4 providers will consume this.CLI: real
secrets login|logout|status(replaces the stub).login <provider> --token …stores the credential; on a keyring-less host it degrades — warns, names the env var to set, exits 0 (tool keeps working).status [provider…]reports keyring availability + per-provider source (env|keyring|none).openKeyringseam makes both branches deterministically testable.Tests
internal/secrets: Mem round-trip;KeyringAvailabletrue/false;CredEnvVarformatting;CredentialForresolution order (env > keyring > none; nil-safe).internal/cli: login persists + status shows keyring; login degrades without keyring (warns, names env var, stores nothing); login requires--token.make cigreen.Deps / constraints
go-keyring + godbus + wincred are all pure-Go →
CGO_ENABLED=0static build intact. govulncheck: only local go1.26 stdlib advisories (N/A to CI's Go 1.25.x); zero module-level findings against the new deps.Spec acceptance (spec 04)
secrets logindegrades to env-var mode with a clear warning (tool still works).🤖 Generated with Claude Code