Repository navigation
fix(connection): refuse to connect when a profile expects an SSH tunnel - #556
Merged
Merged
Conversation
Closes #273. The dialog collects an SSH host, port, username, password and private-key passphrase. The store keeps them, and the keyring holds the secrets. Nothing reads any of it. There is no ssh2 or russh dependency anywhere in the tree, and `connect` builds its options from `profile.host` and `profile.port` alone. So a profile configured to tunnel through a bastion connected straight to the database host, while every part of the UI said otherwise. Someone who believes their traffic is tunnelled may be reaching a database over the open internet. Both `connect` and `test_connection` now refuse such a profile and say what would have happened instead, naming the SSH host and the direct host:port so the mismatch is visible. `test_connection` matters as much as `connect`: a Test Connection reporting success by reaching the database directly is the strongest possible false assurance that the tunnel works. An SSH config with a blank host is not treated as a request to tunnel — the dialog can leave one behind after its fields are cleared. The SSH tab now says the feature is not implemented, before any credentials are typed, and says what to do instead: open a tunnel and point the profile at the forwarded local port. Refusing rather than removing the tab: it is reversible, it leaves stored configuration alone for whenever the tunnel is built, and deleting a visible feature is a product decision rather than a bug fix. Connecting anyway was the one answer that could not stay. Three unit tests on the refusal, two on the dialog; the dialog pair fails against the previous version. Co-Authored-By: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #273.
What was happening
The dialog collects an SSH host, port, username, password and private-key passphrase. The store keeps them, and the keyring holds the secrets. Nothing reads any of it.
There's no
ssh2orrusshdependency anywhere in the tree, andconnectbuilds its options fromprofile.hostandprofile.portalone. So a profile configured to tunnel through a bastion connected straight to the database host, while every part of the UI said otherwise.Someone who believes their traffic is tunnelled may be reaching a database over the open internet. That's the security half of the label, and it's why this is worse than not offering the feature at all.
What changes
connectandtest_connectionboth refuse such a profile and say what would have happened instead, naming the SSH host and the directhost:portso the mismatch is visible.test_connectionmatters as much asconnecthere: a Test Connection reporting success by reaching the database directly is the strongest possible false assurance that the tunnel works.An SSH config with a blank host isn't treated as a request to tunnel — the dialog can leave one behind after its fields are cleared.
The SSH tab now says the feature isn't implemented before any credentials are typed, and says what to do instead: open a tunnel yourself and point the profile at the forwarded local port.
Why refuse rather than remove the tab
Refusing is reversible, leaves stored configuration alone for whenever the tunnel is actually built, and keeps the decision open. Deleting a visible feature is a product call rather than a bug fix — say the word if you'd rather the tab went entirely.
Connecting anyway was the one answer that couldn't stay.
Tests
Three unit tests on the refusal (no SSH is allowed, a configured tunnel is refused with both hosts named, a blank host isn't a tunnel) and two on the dialog. The dialog pair fails against the previous version.
1786 unit + 303 browser, 61 Rust lib, 54 integration against live servers, clippy/tsc/dprint/eslint clean.
Also closed, already fixed
Four connection issues turned out to be done and never closed — the PRs referenced them as
Refs #Nrather than with closing keywords. Each now has a comment naming the commit and what changed:save_connection_profilesilently wipes the OS keyring password whenget()fails #274 — keyringget()failure no longer wipes the stored password (fix(connection): stop a locked keyring from deleting the stored password #526)read_onlyprofile flag is UI-only — backend executes DML/DDL unrestricted (FR-1.2.7) #277 —read_onlyis enforced in the executor and badged in the tab (fix(connection): stop a locked keyring from deleting the stored password #526)init_keyring()panic on Linux +ConnectionStore::new.expect()block all app launches #278 — the app starts without a keyring, in a degraded mode (fix(connection): start without a keyring, and stop cancelled connects leaking #527)activeConnectionsmap (test documents as expected) #280 — connect/disconnect race no longer leaks a server-side pool (fix(connection): start without a keyring, and stop cancelled connects leaking #527)🤖 Generated with Claude Code