Skip to content

fix(security): store DB and SSH credentials exclusively in OS keychain and tighten CSP - #68

Open
withRen wants to merge 1 commit into
veloxbase:mainfrom
withRen:fix/credential-storage-and-csp
Open

withRen wants to merge 1 commit into
veloxbase:mainfrom
withRen:fix/credential-storage-and-csp

Conversation

@withRen

@withRen withRen commented Nov 20, 2026

Copy link
Copy Markdown

Summary

Fixes credential persistence gaps in the Rust backend and tightens the Tauri CSP:

  1. Enable native OS keychain backends for keyring v3 (src-tauri/Cargo.toml, src-tauri/Cargo.lock)

    • keyring = "3" does not enable any platform credential store by default. Added explicit features: apple-native, windows-native, sync-secret-service, and crypto-rust.
  2. Prevent plaintext DB and SSH secrets from being written to JSON (src-tauri/src/db/connection_pool.rs, src-tauri/src/models.rs)

    • persist_connection_with_password previously set stored.password = Some(password.to_string()) and wrote it to the local JSON store before saving to the keychain, and rename_connection_in_store wrote it back after loading.
    • Added SshConfig::redacted() and StoredConnection::redacted() so persist_connection always strips password, ssh_config.password, and ssh_config.passphrase before serializing to disk.
    • Updated StoredConnection::summary() to use SshConfig::redacted() so SSH secrets are not sent to the frontend in ConnectionSummary.
    • Updated load_connection to load SSH secrets from the OS keychain and migrate/clean any legacy plaintext DB or SSH secrets from existing JSON stores.
  3. Store and delete SSH credentials in OS keychain (src-tauri/src/credentials.rs, src-tauri/src/commands/connections.rs)

    • Added store_ssh_password, get_ssh_password, delete_ssh_password, store_ssh_passphrase, get_ssh_passphrase, and delete_ssh_passphrase.
    • Updated delete_connection to also remove SSH keychain entries.
  4. Remove 'unsafe-eval' from CSP (src-tauri/tauri.conf.json)

    • Changed script-src 'self' 'unsafe-eval' to script-src 'self'.

Verification

  • Added unit tests in src-tauri/src/models.rs (redacted_strips_db_and_ssh_secrets_before_serialization, summary_does_not_expose_ssh_secrets).
  • cargo test --lib: 117 passed, 0 failed.
  • pnpm test: 115 passed, 0 failed.
  • Built macOS release bundle (tauri build -b app).

@sonarqubecloud

Copy link
Copy Markdown

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