r/mysql • • 18d ago

solved Latest MySQL Workbench Fields - copy/paste no input sanitization warning

What a waste of 2 hours.

Create SSH tunnel.

Copy/paste usernames and IP addresses from our password storage system.

Cannot connect

Connection Error: Error opening MySQL session through SSH tunnel: Lost connection to MySQL server at 'reading initial communication packet', system error: 0. Workbench.

Check everything on the server three times. What is going on?

Turns out that there is zero input sanitization on the username/ip fields and so Workbench is sending the escaped spaces!

myusername = unername%20
192.168.1.100  = 192.168.1.100%20%20
4 Upvotes

6 comments sorted by

4

u/Aggressive_Ad_5454 18d ago

Yeh. EOL software owned by an outfit that doesn’t really care about it.

HeidiSQL. Or DBeaver.

1

u/MrAtoni 12d ago

I mean, Workbench isn't EOL (anymore), but the new Workbench is pretty bareboned so DBeaver and Hidi is still the better options.

1

u/ssnoyes 12d ago

Did you file this at https://bugs.mysql.com/ ?

1

u/dirtcreature 9d ago

I don't work for the Ellisons, so no.

1

u/Flimsy_Swan5930 2d ago

Can I file the fact that it’s now written in electron as a bug?

1

u/navicat-gu 5d ago

Painful one. Trailing whitespace from password managers catches a lot of people, and that SSH error message gives you nothing to go on. A few things that save time next time:

  1. Test the tunnel outside Workbench first. If this works from a terminal, your SSH details are right and the problem is in the client:
ssh -L 3307:127.0.0.1:3306 myuser@192.168.1.100
# then, in another terminal:
mysql -h 127.0.0.1 -P 3307 -u dbuser -p
  1. Have Workbench use that tunnel. With the ssh -L above running, create a plain "Standard TCP/IP" connection to 127.0.0.1:3307. That skips Workbench's SSH fields completely, and you can keep the tunnel in ~/.ssh/config so you never paste hosts again.
  2. Paste into a plain-text field first. For example, the browser address bar or printf '%q\n' "<paste>" in a terminal, so stray spaces become visible.
  3. File it at bugs.mysql.com with the %20 detail, as ssnoyes said. It's a clear, reproducible bug.

Disclosure: I'm RC, Director of Digital Strategy @ Navicat. If you end up trying other clients, Navicat 18 has SSH tunnel settings on the connection and a "Test Connection" button that checks the tunnel before you save. Navicat Premium Lite, the free edition, includes SSH/SSL. DBeaver and HeidiSQL, which others mentioned, also do SSH tunnels.