Skip to content

feat(secrets): S5 — keyring-backed secrets login with WSL2 env-var fallback (spec 04) - #59

Merged
gustavobertoi merged 1 commit into
mainfrom
nightly/S5-login
Jun 29, 2026
Merged

feat(secrets): S5 — keyring-backed secrets login with WSL2 env-var fallback (spec 04)#59
gustavobertoi merged 1 commit into
mainfrom
nightly/S5-login

Conversation

@gustavobertoi

Copy link
Copy Markdown
Contributor

What

Completes M4's S5: keyring-backed provider credentials with a clean WSL2 degrade path.

How

internal/secrets/keyring.go:

  • Keyring interface + OSKeyring (zalando/go-keyring — Secret Service / Keychain / Credential Manager, namespaced devstack) + MemKeyring in-process fallback.
  • KeyringAvailable probes 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).
  • An openKeyring seam makes both branches deterministically testable.

Tests

internal/secrets: Mem round-trip; KeyringAvailable true/false; CredEnvVar formatting; CredentialFor resolution 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 ci green.

Deps / constraints

go-keyring + godbus + wincred are all pure-GoCGO_ENABLED=0 static 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)

  • Provider credential resolution order: env → managed keyring → native default.
  • On WSL2 without D-Bus, secrets login degrades to env-var mode with a clear warning (tool still works).

🤖 Generated with Claude Code

…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>
@gustavobertoi
gustavobertoi merged commit d7ca28a into main Jun 29, 2026
2 checks passed
@gustavobertoi
gustavobertoi deleted the nightly/S5-login branch June 29, 2026 18:32
gustavobertoi added a commit that referenced this pull request Jun 29, 2026
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