Repository navigation
Description
Problem
Cyd does not have a consistent desktop-wide credential-storage policy.
The existing X-to-Bluesky migration OAuth implementation serializes NodeSavedSession and OAuth state into the X account's unencrypted SQLite config table. The saved session contains access/refresh tokens and a private DPoP JWK. The generic SQLite debug logger also logs statement parameters, which can expose those serialized secrets in development logs.
X login cookies are different: Electron/Chromium stores them in persistent persist:account-{id} partitions and selects the platform password backend. Cyd currently does not inspect or communicate which backend protects them.
This security work is important but is intentionally separate from the project adding full Bluesky platform support.
Policy
Cyd must not persist account-control credentials in application-managed plaintext storage.
Acceptable storage includes macOS Keychain, Windows OS-backed protection, and Linux libsecret or KWallet through Electron/Chromium facilities. On Linux only, Cyd may deliberately fall back to Chromium/Electron's basic_text backend when neither libsecret nor KWallet is available, provided the limitation is detected and clearly disclosed to the user.
Credentials include OAuth access and refresh tokens, private DPoP keys, authorization state containing secrets, app passwords, reusable session material, and authentication cookies.
Scope
- Introduce one credential-storage abstraction and policy for desktop account integrations.
- Move existing X-to-Bluesky migration OAuth state/session data out of per-account SQLite config rows.
- Ensure new writes never place OAuth tokens or private DPoP JWKs in SQLite, logs, archives, diagnostics, or ordinary account-data directories.
- Remove or redact secret-bearing SQL/debug logging.
- Migrate existing stored OAuth credentials safely, then delete legacy config rows and account for SQLite WAL/journal remnants as reasonably possible.
- Revoke and discard credentials cleanly on disconnect and local-account deletion.
- Treat Electron/Chromium persistent cookie storage as the credential store for X, while detecting the selected Linux backend.
- On Linux, prefer libsecret/KWallet; when forced to
basic_text, show a clear warning that persisted login cookies and credentials are not protected at rest. - Document the threat model and platform behavior without claiming stronger protection than the selected backend provides.
Acceptance criteria
- macOS and Windows credentials are persisted only through OS-protected facilities.
- Linux uses libsecret or KWallet when available;
basic_textis an explicitly detected, disclosed fallback only when neither is available. - X-to-Bluesky OAuth tokens and private DPoP keys no longer appear in plaintext SQLite values.
- Credential values never appear in application logs, exported archives, diagnostics, or error reports.
- Existing OAuth sessions are migrated or invalidated safely, with legacy plaintext rows removed.
- Disconnect and account deletion remove persisted credential material.
- Automated tests cover protected storage, migration, redaction, deletion, unavailable backends, and the disclosed Linux fallback.
- A manual verification checklist covers macOS Keychain, Windows protection, GNOME/libsecret, KDE/KWallet, and Linux
basic_textfallback.
(This comment was written by an LLM)
Activity
Protect persisted account credentials from plaintext storage