Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global shortcut fails when focused field is a password field #17

Closed
lwouis opened this issue Sep 9, 2019 · 6 comments
Closed

Global shortcut fails when focused field is a password field #17

lwouis opened this issue Sep 9, 2019 · 6 comments
Labels
bug Something isn't working
Milestone

Comments

@lwouis
Copy link
Owner

lwouis commented Sep 9, 2019

image
Pressing alt-tab here doesn't trigger the app. Somehow the tab event is not propagated to the app in that case, potentially for security purpose.

There may or may not be a way to work around this behaviour.

@lwouis lwouis added the bug Something isn't working label Sep 9, 2019
@lwouis
Copy link
Owner Author

lwouis commented Oct 17, 2019

The built-in command-tab shortcut works in that scenario. This either means there is a way to work around the tab key being absorbed by the password field, or that it has security privileges as an OS tool.

@lwouis lwouis added the L size label Oct 17, 2019
@lwouis
Copy link
Owner Author

lwouis commented Oct 28, 2019

I tested other apps and here are the results:

  • AltTab: tab keypress is absorbed by AltTab
  • HyperSwitch: tab keypress is sent to the password field
  • WindowSwitcher: works fine!

WindowSwitcher shows that it's possible and not an OS limitation

@lwouis
Copy link
Owner Author

lwouis commented Oct 28, 2019

It seems the current CGEvent.tapCreate hides keypresses on password fields. However, the OS has other APIs to do it.

Solution would be to use a OSS library handling shortcuts correctly (even passwords):

This would also help with the #49 story

@lwouis
Copy link
Owner Author

lwouis commented Oct 30, 2019

I can confirm that ShortcutRecorder is not affected by the limitation. Using GlobalShortcutMonitor which internally uses the Carbon API let's us intercept the event before it reaches the password field, somehow. This seems to me like a clear security breach on Apple's part that anyone can keylog password field using old-but-still-available APIs.

@lwouis
Copy link
Owner Author

lwouis commented Apr 1, 2020

@lwouis
Copy link
Owner Author

lwouis commented Apr 19, 2020

I'm closing this ticket as I'm actually happy that the current implementation is respecting the password field design to not let other apps read keys on a password field.

Even if I could do it, I wouldn't want to do it. It's a very rare and minor inconvenience to not be able to switch windows when focus is on a password field, but the reward is more security.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant