Skip to content

feat: add secure credential storage with OS keychain backends#97

Draft
felipefreitag wants to merge 11 commits intomainfrom
worktree-secure-credential-storage
Draft

feat: add secure credential storage with OS keychain backends#97
felipefreitag wants to merge 11 commits intomainfrom
worktree-secure-credential-storage

Conversation

@felipefreitag
Copy link
Contributor

Store API keys in the OS keychain (macOS Keychain, Linux Secret Service, Windows Credential Manager) instead of plaintext files. Falls back to file-based storage when no keychain is available.

  • Add CredentialBackend interface with isSecure property and implementations for macOS, Linux, Windows, and plaintext file
  • Add async variants of config functions (resolveApiKeyAsync, storeApiKeyAsync, removeApiKeyAsync, removeAllApiKeysAsync, renameProfileAsync)
  • Add resend auth migrate command for migrating between storage backends
  • Add --insecure-storage flag and RESEND_CREDENTIAL_STORE env var
  • Update doctor command to check credential storage and use async key resolution
  • Show storage type in whoami output
  • Parallelize independent keychain operations in removeAll and migrate

Store API keys in the OS keychain (macOS Keychain, Linux Secret Service,
Windows Credential Manager) instead of plaintext files. Falls back to
file-based storage when no keychain is available.

- Add CredentialBackend interface with isSecure property and implementations
  for macOS, Linux, Windows, and plaintext file
- Add async variants of config functions (resolveApiKeyAsync, storeApiKeyAsync,
  removeApiKeyAsync, removeAllApiKeysAsync, renameProfileAsync)
- Add `resend auth migrate` command for migrating between storage backends
- Add --insecure-storage flag and RESEND_CREDENTIAL_STORE env var
- Update doctor command to check credential storage and use async key resolution
- Show storage type in whoami output
- Parallelize independent keychain operations in removeAll and migrate
- Fix whoami for keychain users (async resolveApiKeyAsync)
- Fix Windows PowerShell injection by passing secret via stdin
- Fix migration data loss: write file before deleting from keychain
- Fix login.ts to use resolveApiKeyAsync and update description
- Document macOS process arg exposure limitation
- Add test coverage for async config, whoami keychain, migrate, windows backend
Test Windows (PasswordVault, Win32 P/Invoke, cmdkey), Linux
(secret-tool + dbus/gnome-keyring), and macOS (security command)
on GitHub Actions runners.
… CI setup

- Add `await` to `requireClient()` call in listen.ts after merging main
  (requireClient became async in our credential storage branch)
- Replace dbus-send CreateCollection with gnome-keyring-daemon --start
  and python3-secretstorage verification for more reliable Linux CI keyring setup
…ction

secret-tool expects /org/freedesktop/secrets/collection/login which is
created by --unlock, not --start. Combine install + keyring setup +
secret-tool test into a single step so dbus/keyring env vars persist
without GITHUB_ENV. Re-establish dbus+keyring in the Node.js step
since actions/setup-node forces a step boundary.
- Use dbus-run-session to wrap secret-tool commands in a proper D-Bus
  session (fixes login collection not being created with dbus-launch)
- Add detailed logging: env vars, unlock output, D-Bus services, and
  collections to diagnose any remaining keyring issues
- Add Linux hint in login.ts when falling back to plaintext file storage,
  suggesting libsecret-tools + gnome-keyring installation
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