Skip to content

feat(security): production-ready SSH tunneling and Bastion Host support - #1075

Merged
ZhuchkaTriplesix merged 2 commits into
devfrom
issue/1031-ssh-tunneling-bastion
Oct 5, 2026
Merged

ZhuchkaTriplesix merged 2 commits into
devfrom
issue/1031-ssh-tunneling-bastion

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

Implements built-in SSH Bastion / Jump Host tunneling support for PostgreSQL, MySQL, MongoDB, and Redis.

Key Changes

  • Dependency: Added dartssh2: ^4.1.0.
  • Core Architecture & Models:
    • SshTunnelConfig and SshTunnelSecrets with support for Password, Private Key (PEM, OpenSSH, RSA, Ed25519) + Passphrase, and SSH Agent authentication ($SSH_AUTH_SOCK / Windows Named Pipe).
    • Multi-hop ProxyJump / Jump Host support.
    • Zero-leak security guarantee: SSH secrets stored strictly in ConnectionSecretsStore (OS Keychain, libsecret, DPAPI), plain SQLite querya.db stores only non-sensitive config in driverOptions['ssh_tunnel']. Immediate in-memory scrubbing/zeroing after authentication.
  • Ephemeral Port Forwarding & Connection Pooling:
    • SshTunnelManager: Binds local ephemeral loopback port (127.0.0.1:0), establishes SSH channel forwarding to remote database host/port.
    • Reference-counting session pool for sharing bastions across multiple queries, tabs, and database connections.
    • Keep-alive ping mechanism (ServerAliveInterval) and graceful teardown on close/disconnect.
  • Database Adapters:
    • Integrated tunnel forwarding in PostgresConnection, MysqlConnection, MongoConnection, and RedisConnection.
  • UI & Forms:
    • Reusable SshTunnelSection widget with interactive authentication selectors, file picker for private keys, fingerprint validation, and a "Test SSH Connection" button.
    • Integrated into PostgreSQL, MySQL, MongoDB, and Redis connection forms.
  • Tests:
    • Added unit tests in test/core/security/ssh_tunnel_test.dart covering configuration, secret scrubbing, and ConnectionRow serialization.
    • Updated test/core/storage/local_db_secrets_test.dart verifying secure store persistence and secrets merging.

Closes #1031

@github-actions github-actions Bot added enhancement New feature or request network Remote install, HTTP download core Core library logic and services connections Database connections, URI parsing, pools backend Backend database driver execution and queries P1 High priority / Core capability labels Oct 5, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 4d62789 into dev Oct 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend database driver execution and queries connections Database connections, URI parsing, pools core Core library logic and services enhancement New feature or request network Remote install, HTTP download P1 High priority / Core capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant