Repository navigation
feat(connection-import): import connections from MySQL Workbench - #1355
Conversation
Add MySQL Workbench to Import connections > Import from App. The importer reads connections.xml from Workbench's data folder (found automatically on Linux, macOS and Windows, with a manual folder or file path as fallback) and maps each TCP/IP and TCP/IP over SSH connection to a MySQL connection: name, host, port, user, default schema, the SSL level and certificate paths, and the SSH host, port, user and key file. Local socket connections and other Workbench drivers are skipped with a log warning so they do not fail the whole import. Passwords live in the OS keychain or Workbench's vault and are not imported. Closes #1310
| database: get("schema").unwrap_or("").to_string(), | ||
| username: get("userName").unwrap_or("").to_string(), | ||
| driver_label: "MySQL".to_string(), | ||
| ssh: if over_ssh { parse_ssh(¶ms) } else { None }, |
There was a problem hiding this comment.
WARNING: SSH connection silently downgraded to a direct connection
For a native_sshtun connection, parse_ssh returns None when sshHost is missing or empty, so the connection is imported with ssh: None. Its host is typically a private address only reachable through the tunnel, so the imported connection is created without a tunnel and will fail to connect, with no indication why. Either skip the connection with a log::warn! (like the unsupported drivers) or surface a warning when over_ssh is true but no SSH config could be built.
| "password" | ||
| } | ||
| .to_string(), | ||
| private_key_path: key_file.map(resolve_key_path), |
There was a problem hiding this comment.
WARNING: Windows key paths are mangled by resolve_key_path
resolve_key_path only treats paths starting with / or ~/ as absolute. This importer explicitly supports Windows (%APPDATA%\MySQL\Workbench), where sshKeyFile is typically an absolute path like C:\Users\me\.ssh\id_rsa. It would be rewritten to ~/.ssh/C:\Users\me\.ssh\id_rsa, which does not exist, so key auth breaks for Windows Workbench users. Workbench stores the full path chosen in its UI, so it is not a bare filename. Keep absolute paths (including drive-letter and UNC paths) as-is, e.g. by checking Path::new(key).is_absolute() before falling back to resolve_key_path.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The latest commit only moves the unit tests of Files Reviewed (2 files)
Previous Review Summaries (2 snapshots, latest commit 1e39902)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 1e39902)Status: No Issues Found | Recommendation: Merge Both previous findings are resolved in the latest commits:
Files Reviewed (2 files)
Previous review (commit 00bc9dc)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (3 files)
Reviewed by claude-sonnet-5.5 · Input: 252 · Output: 856 · Cached: 161.1K Review guidance: REVIEW.md from base branch |
Skip an SSH tunnel connection that has no SSH host instead of importing it as a direct connection to a host that is usually only reachable through the tunnel. Keep absolute SSH key paths as they are, including Windows drive-letter and UNC paths, which resolve_key_path would take for a bare file name and rewrite under ~/.ssh.
debba
left a comment
There was a problem hiding this comment.
Thanks @arxhr007 for adding both the discovered and manually selected Workbench paths, and for skipping a tunnel entry with a missing SSH host instead of turning it into a direct connection. I appreciate the clear note about the fixture's provenance and what you couldn't test.
I checked the parser, SSL/SSH mapping and registration, and ran the connection-import tests on this branch. One small follow-up: please move the inline mysql_workbench.rs test module into a sibling test file, following rule 4 in .rules/rust.md.
That nit doesn't block the change for me. I'll keep the merge pending the app checks; those will use fixtures and won't establish compatibility with every real Workbench export.
This is your first PR in this repo. If you'd like to join us on Discord, we'd be happy to have you: https://discord.com/invite/K2hmhfHRSt
…ing file Follows rule 4 in .rules/rust.md. The three tests are unchanged apart from the indentation.
debba
left a comment
There was a problem hiding this comment.
Thanks @arxhr007 for moving the Workbench helper tests into their own file while keeping all three tests and their assertions intact. The direct and SSH fixture cases still cover SSL mapping, missing SSH hosts and the paths that should be skipped.
I ran all 52 connection-import tests on your head. I also merged current main to resolve the overlap with the new HeidiSQL importer, preserving both registrations and both sets of tests; all 67 connection-import tests pass on that integrated head. I have not found any remaining issues. Approved.
The fixture-based checks do not establish compatibility with every real Workbench export. I will merge once the checks on the updated head finish.
Closes #1310.
What
Adds MySQL Workbench to Import connections > Import from App. The importer reads
connections.xmlfrom Workbench's data folder (~/.mysql/workbenchon Linux,~/Library/Application Support/MySQL/Workbenchon macOS,%APPDATA%\MySQL\Workbenchon Windows). If it is not found there, a folder or theconnections.xmlfile can be chosen by hand.Each Standard TCP/IP and Standard TCP/IP over SSH connection becomes a MySQL connection with:
useSSL1 to 4 maps topreferred,required,verify_ca,verify_identity) and the CA, certificate and key pathsLocal socket connections and other Workbench drivers are skipped with a
log::warn!, so one of them does not fail the whole import. Passwords are not imported (they live in the OS keychain or Workbench's vault), as described in the issue.The importer is a new
mysql_workbench.rsnext to the others, registered inall_importers(). It does not depend on Tauri, and no frontend change was needed.Tests
Fixture-based tests in
importer_tests.rscover a direct connection with SSL, an SSH connection, a skipped socket connection, a manual folder and file path, and the missing file, invalid XML and empty file errors. Two unit tests cover thehost:portsplit and theuseSSLlevels.Verification
cargo check --no-default-features --bin tabularispasses.cargo teston the full crate on my machine because thetauridev-dependency needs GTK and WebKit libraries. I ran the new tests (5) in a small separate crate that compilesmysql_workbench.rswith the realtypes.rsand importer trait, and they pass. Theimporter_tests.rsadditions have not run inside this repo's own test target, so CI will be their first run there.connections.xmlstructure (driver ids,parameterValueskeys,sshHostashost:port) is taken from two third-party fixtures of Workbench's format; I do not have a real export from a Workbench install. My fixture follows the same shape with fake hosts. If someone with Workbench can confirm that a real file imports, that would be a useful check.Workbench connection groups are not imported, because I could not confirm how they are stored.
Need help on this PR? Tag
@codesmith-botwith what you need.