warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.38k stars 373 forks source link

Improper known_hosts parsing in ssh autocompletions #4985

Open ShaTie opened 5 months ago

ShaTie commented 5 months ago

Dupe Check

Describe the bug

When using the Warp terminal, there is an issue where SSH host suggestions are incorrectly parsed if the hosts listed in the known_hosts file have custom ports specified. The terminal fails to recognize and handle the custom port format correctly, leading to connection errors.

To reproduce

  1. Ensure the known_hosts file includes entries with custom ports, formatted as [hostname]:port.
  2. Attempt to use the SSH suggestions feature in Warp to connect to one of these hosts.
  3. Observe that the terminal incorrectly parses the hostname and port, resulting in a “no matches found” error.

Expected behavior

The SSH suggestion feature should correctly parse and display hosts with custom ports, allowing seamless connection without manual input corrections. Add the ability to disable hints from known_hosts

Screenshots

SCR-20240605-eqte SCR-20240605-erfi SCR-20240605-esbu SCR-20240605-evsy

Operating system

MacOS

Operating system and version

Sonoma 14.5 (23F79)

Shell Version

zsh 5.9 (x86_64-apple-darwin23.0)

Current Warp version

v0.2024.05.28.08.02.stable_00

Regression

No, this bug or issue has existed throughout my experience using Warp

Recent working Warp date

No response

Additional context

No response

Does this block you from using Warp daily?

Yes, this issue prevents me from using Warp daily.

Is this a Warp specific issue? (i.e. does it happen in Terminal, iTerm, Kitty, etc.)

Yes, this I confirmed this only happens in Warp, not other terminals.

Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e

None

dannyneira commented 5 months ago

Hi @ShaTie Sorry about this blocker. As a workaround you can add command ssh to your Settings > Subshells > Added commands menu, then run command ssh <user@server> to connect to remote session, this will attempt to enable Warp features as a subshell.

You can also disable the SSH Wrapper by navigating to Settings > Features. Blocks will stop working but with it disabling, SSH should work as normal.

Related docs: https://docs.warp.dev/features/ssh https://docs.warp.dev/features/subshells

If those don't work, please let us know.

ShaTie commented 5 months ago

Hi. As ssh Wrapper works as well as blocks. But it is very inconvenient to connect to hosts, because I have to erase brackets after autocomplete. The workaround with command ssh is totally inconvenient because autocomplete doesn't work there at all, maybe there is a way to make autocomplete work with 'command'? My zsh shell is running autocomplete in iterm2 How can I help? Version of ssh: OpenSSH_9.6p1, LibreSSL 3.3.6 Examples of hosts

[ltx241.test.ru]:30022 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCplpDbpwdcJiIOQkwy+RnJtvsMMGo5JS4iarRDBOyFK0+DxSAAAAB3NzaC1yc2EAAAADAQABAAABgQCxdAwTe5c4f6GNUPEmfR4apA3QY9EbLeeBm8X6cWkSKhBvCx7HczayKZNXviZZ8HGmP4kCm1NeELo1MUQqsI5MSXDlUkr3KuF3aO7g3yNhplmuTuARmpEh2N6imu9Douttn+cPRjvQokzSTYzqvj1cQMRg7qhDaQBtvbEPom9+ClumBlXFuU1bwtwTip1pP8cQD2W6wYdPQkoDc4fLHs5mC8qC4wvuwfMvxSMxmKutl8WJryAse0FO5PS1mlUPLif3TR8aN/kyN9O/XoWDK6Tw4pLCqvL7pzIRmeZnzQIGP8OOXyJPNJ6iAOc7cGyu0hV/mNtdLW/TI9Iz/cc6N8OsNuWRxiU7cvnQ7xWAY95SSfzUiyyxBDNr34KJcVnwncfWPZ8tRUkEXD8TSqSW0s37/qO1i7CPBDtJUX
[100.11.80.32]:30022 ssh-rsa /BMv+AYib4PvM+LblXepjrnLvnSTpaaB3wMO50j6A2WUKiNPLsOUjNUE/QYfBHL3tja78Y9n+T3ndblNw7g3qfM5gZOTygBu/Gs/KX9eWO6VTFf6AsQUmerLsEYrXxYOodCMK451HKQ5U5+G2MyXUb+FqxevtbaFvBvNaD0PQS7dafoZuXhwQhOyOR0wViPrLV1O/oD1cgRe2uySo33fftqqG/PcQnx+8F/dC+x+UOxW4YoU8xYjeioiLJcHt9pEZvKiNxFpY5vCvN2hKOFtj1WJtKvju9qJWEo6D+Pk388L1CrMy4B3BnZp0rjsG6vNPCNZ3z0TrUOyIagcl1fo8/GxU5SBVQeHHCM4iG1BCkonvO+O6bup2R1G7k8ovHdIpZM=