zed icon indicating copy to clipboard operation
zed copied to clipboard

Fix SSH password issue

Open mzaks opened this issue 7 months ago • 4 comments

Closes #21700

Release Notes:

  • Show a warning if the user is entering an SSH password with Caps Lock enabled. Also, provide clear feedback when the password entered is incorrect.

mzaks avatar May 01 '25 17:05 mzaks

We require contributors to sign our Contributor License Agreement, and we don't have @mzaks on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

cla-bot[bot] avatar May 01 '25 17:05 cla-bot[bot]

@cla-bot check

mzaks avatar May 01 '25 17:05 mzaks

The cla-bot has been summoned, and re-checked this pull request!

cla-bot[bot] avatar May 01 '25 17:05 cla-bot[bot]

Warnings
:warning:

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by :no_entry_sign: dangerJS against d4a1167fbd410b165da42d954f1445c605e35754

zed-industries-bot avatar May 01 '25 18:05 zed-industries-bot

Thanks for this!

I don't think we should show try again. Depending on how you are SSH'ing you may be prompted to enter multiple different passwords (for example when jumping through a jump host). I think this fix would be better sent upstream where SSH can (hopefully!) tell whether it's asking for the same password again or not and give us a better prompt.

For handling caps I'm a bit nervous about putting it on the modifiers struct. In particular keyboard shortcuts (And other places) assume they can do == to tell which modifiers are held down. As I would like Zed's shortcuts to work regardless of the caps lock status, I think we need to either update the implementation of Eq to ignore the caps key, or remove the Eq trait and use a non-symmetric equals like should_match on the keystroke.

The alternative would be to have some additional state that's updated on the App to track whether or not caps-lock is down. Then you could query for caps-lock with cx.has_caps_lock().

Closing for now, but feel free to re-open with a different approach.

ConradIrwin avatar May 06 '25 08:05 ConradIrwin

@ConradIrwin I understand your concerns, so I took another stab at it see #30470. I don't try to warn about the wrong credentials anymore just adding caps lock support by identifying the event and storing it on Window/PlatformWindow. The warning in SshPrompt is very simple, kind of "developer art" to see if the underlying logic works. I guess a designer should give it a pass at some point. IMHO every editor widget in password mode (masked input) should warn user about caps lock being on.

I tested the behaviour on macOS, Linux with Wayland and Windows, sadly I could not test on Linux with X11, but I did replicate the behaviour of modifiers, so I hope it works.

Let me know if there are some things you want changed.

mzaks avatar May 10 '25 16:05 mzaks