Keeweb: password isn't typed in autotype sequence (linux)

Created on 15 Feb 2020  Â·  32Comments  Â·  Source: keeweb/keeweb

Describe the bug
After resetting my PC and installing KeeWeb again, I found out, that the autotype isn't working correctly anymore. When starting an autotype sequence with a password, only one character gets typed as password. KeeWeb shows an error message afterwards. In contrast, when trying to type just the password, it succeeds.
This issue already exists some time now, but as I have some special setup so I wasn't sure it's a problem of KeeWeb or not. Recently I setup a for @timoIpeters and the issue is the same, so that's probably a problem of KeeWeb.

To Reproduce

  1. start a autotype sequence via your keybind (default Alt-Shift-T)
  2. select a entry
  3. see that only one character of the password gets typed and an error gets shown in KeeWeb

Workaround

  1. start autotype
  2. select the user
  3. go into password field
  4. start autotype
  5. select password
    (6. go to 2FA and start autotype again and select 2FA)
  6. get logged in

Expected behavior
Autotype types the full password and proceeds with it's sequence.

Environment

KeeWeb v1.12.3 (9b07bbd5, 2019-11-06)
Environment: electron v7.0.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) KeeWeb/1.12.3 Chrome/78.0.3905.1 Electron/7.0.0 Safari/537.36

To be more specific:

Linux Generic 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux

Logs (shortened)

[INFO ] 2020-02-15T18:30:55.194Z [auto-type] Active window matches
[DEBUG] 2020-02-15T18:30:55.196Z [auto-type] Start {USERNAME}{TAB}{PASSWORD}{ENTER}
[DEBUG] 2020-02-15T18:30:55.198Z [auto-type] Parsed [op:USERNAME,op:TAB,op:PASSWORD,op:ENTER]
[DEBUG] 2020-02-15T18:30:55.201Z [auto-type] Resolved [*******************,key:tab,[*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*],key:enter]
[INFO ] 2020-02-15T18:30:55.555Z [launcher] spawn xdotool: 0, 350ms
[ERROR] 2020-02-15T18:30:55.676Z [launcher] spawn xdotool: 2, 119ms

Error: Invalid key sequence ']'
Failure converting key sequence ']' to keycodes
Error: Invalid key sequence ']'
Failure converting key sequence ']' to keycodes
xdo_send_keysequence_window reported an error for string ']'
[ERROR] 2020-02-15T18:30:55.677Z [auto-type] Run error Exit code 2
auto-type bug desktop linux

Most helpful comment

hèhè, xdotool doesn't like if stdin doesn't end with \n and it seems to just read memory further and type what's there or fail because of wrong memory access, now I think I've finally fixed it, a release is coming soon.

All 32 comments

Hi! I guess, it's a duplicate of this: https://github.com/keeweb/keeweb/issues/1251
Maybe not exact, but in any case, this comes from xdotool.

That's not the same! The other issue is about wrong special characters. This one is about autotype not working when trying to type the password in a sequence, but working when trying to type the password separately.

I guess, it fails to type tab character.

There isn't a tab character in the password and this wouldn't explain why it works when only selecting the password.

It types tab to switch to the next field, that's why it can type the password, but not both.

It switches to the next input field and types the first character. Afterwards it fails.

Also the autotype sequence {USERNAME}{TAB}{USERNAME}{ENTER} works fine.

Hm, that's strange. Does it type it if there are only two first characters in the password?

I don't know whether I understood your question right, but it also fails when the password is 1 or 2 characters long. The first character is always typed but afterwards it fails.

Hm that's weird. Does it depend on the first character?

let's reopen it, it seems to be different

Nope, I created a test entry with following properties:
username: abc
password: def

There isn't anything special in it, so shouldn't be a problem even when xdotool is buggy with special characters. It always fails.

The thing that I'm wondering about is the �]�. There isn't anything like that in the password.

I've had the same problem for a while now.

My configuration

  • Debian Stable (10, buster)
  • Kernel 4.19.0-8-amd64
  • Keeweb v1.14.3 (I had the same problem with the previous version)
  • Xdotool version 3.20160805.1
  • Using test entries: password: abc, password: def

    Description of the error

About the same as molikuner. Autotyping password works, autotyping username works, but autotyping both fails. The default sequence {USERNAME}{TAB}{PASSWORD}{ENTER} fails, while most other work. Tested so far:

  • {USERNAME}{ENTER} :heavy_check_mark:
  • {USERNAME}{SPACE}{PASSWORD}{ENTER} :heavy_check_mark:
  • {USERNAME}{ENTER}{PASSWORD}{ENTER} :heavy_check_mark:
  • {PASSWORD}{TAB}{USERNAME}{ENTER} :heavy_check_mark: !!! (call that the _reference sequence_, produces def abc)
  • {USERNAME}{TAB}{PASSWORD}{ENTER}: :x: (call that the _faulty_ sequence, should produce abc def)

Output

For all working entry, the output matches the expected output. But for the default/faulty one, there is the following output:
abc d <-- there is a TAB character between c and d, I can't render it.

Debug

When typing the _faulty_ sequence, I have the following output:

[DEBUG] 2020-05-23T10:35:14.224Z [auto-type] Start {USERNAME}{TAB}{PASSWORD}{ENTER}
[DEBUG] 2020-05-23T10:35:14.225Z [auto-type] Parsed [op:USERNAME,op:TAB,op:PASSWORD,op:ENTER]
[DEBUG] 2020-05-23T10:35:14.227Z [auto-type] Resolved [***,key:tab,[*,*,*],key:enter]
[INFO ] 2020-05-23T10:35:14.365Z [launcher] spawn xdotool: 0, 137ms
[ERROR] 2020-05-23T10:35:14.465Z [launcher] spawn xdotool: 2, 100ms

Error: Invalid key sequence ']'
Failure converting key sequence ']' to keycodes
Error: Invalid key sequence ']'
Failure converting key sequence ']' to keycodes
xdo_send_keysequence_window reported an error for string ']'
[ERROR] 2020-05-23T10:35:14.466Z [auto-type] Run error Exit code 2

And using the _reference_ sequence:

[DEBUG] 2020-05-23T10:35:10.930Z [auto-type] Start {PASSWORD}{TAB}{USERNAME}{ENTER}
[DEBUG] 2020-05-23T10:35:10.930Z [auto-type] Parsed [op:PASSWORD,op:TAB,op:USERNAME,op:ENTER]
[DEBUG] 2020-05-23T10:35:10.931Z [auto-type] Resolved [[*,*,*],key:tab,***,key:enter]
[INFO ] 2020-05-23T10:35:11.039Z [launcher] spawn xdotool: 0, 107ms
[INFO ] 2020-05-23T10:35:11.114Z [launcher] spawn xdotool: 0, 75ms
[INFO ] 2020-05-23T10:35:11.196Z [launcher] spawn xdotool: 0, 81ms
[INFO ] 2020-05-23T10:35:11.313Z [launcher] spawn xdotool: 0, 117ms
[INFO ] 2020-05-23T10:35:11.339Z [launcher] spawn xdotool: 0, 26ms
[DEBUG] 2020-05-23T10:35:11.339Z [auto-type] Complete 409ms

A lead ?

I tracked the error down, and here are my findings:

Questions left

  • As the _reference sequence_ works, it's not directly linked to xdotool (otherwise, it would fail in every sequence using a tab).
  • The _reference sequence_ spawn xdotool 5 times (why 5?), while the _faulty sequence_ fails at the second.
  • YET, it manages to alt-tab + username + tab + first letter of the password. I supposed the 5 spawns of xdotool where

    1. alt-tab

    2. username

    3. tab

    4. password

    5. enter

      But as the _faulty sequence_ does so much in 1 (or 2) spawn(s), I don't get it.

My guess is that the combo TAB + PASSWORD is the problem here. Every time this sequence is present, it fails the same (after the first character of the password). I still can't explain the debug output, and this strange Failure converting key sequence ']' to keycodes. What is this symbol ? The username and password seem to be represented differently internally (username: ***, password: [*,*,*]). Is it possible that the TAB character followed by some failed representation of [ yields ]?

Conclusion

I'm sorry I can't help out more. This software is awesome, I use it daily. I hope this can help someone track down the problem. Cheers!

I would assume it's because usernames and passwords are auto-typed in different ways: username gets here, while the password is represented as a set of keys here. It looks like typing username doesn't work this way.
What happens if you run xdotool like this:

xdotool key U61 key U62 key U63 key Tab key U64 key U65 key U66

Just reporting that I can finally repeat it on a fresh install of Debian with xfce in a virtualbox, that's good!

What happens if you run xdotool like this:

xdotool key U61 key U62 key U63 key Tab key U64 key U65 key U66

It seems to work, I get the expected output (abc def)

Just reporting that I can finally repeat it on a fresh install of Debian with xfce in a virtualbox, that's good!

Great to hear!

I've fixed it, if you have a dev build working, you can try it (beta won't work because we have changes in the app itself), but at least on my Debian it worked well.
So, the reason is, when we launch xdotool from KeeWeb, somehow it complains about bad characters after executing key Tab, I don't understand why, however the same sequence runs from terminal without any issue. For example, this doesn't work when launched from KeeWeb:
```
xdotool key Tab key U66

But from terminal, works perfectly:

echo "key Tab key U66" | xdotool -
```

Hey @antelle,

Firstly, thanks for looking into this, but unfortunately that didn't help for me. There is still the same error. I created a debian VM where I can reproduce it with v1.15.0 3001afd. I could share that VM with you, if you want.

@molikuner what's printed in logs in your case?

[INFO ] 2020-06-06T18:19:57.558Z [launcher] spawn xdotool: 0, 33ms
Sign in to GitHub · GitHub - Mozilla Firefox (Private Browsing)
25165878
[DEBUG] 2020-06-06T18:19:57.558Z [auto-type] Window info 25165878 Sign in to GitHub · GitHub - Mozilla Firefox (Private Browsing) null
[INFO ] 2020-06-06T18:19:57.560Z [auto-type] Active window matches
[DEBUG] 2020-06-06T18:19:57.561Z [auto-type] Start {USERNAME}{TAB}{PASSWORD}{ENTER}
[DEBUG] 2020-06-06T18:19:57.562Z [auto-type] Parsed [op:USERNAME,op:TAB,op:PASSWORD,op:ENTER]
[DEBUG] 2020-06-06T18:19:57.566Z [auto-type] Resolved [***,key:tab,[*,*,*],key:enter]
[DEBUG] 2020-06-06T18:19:57.631Z [storage-cache] Saved 752edbfe-3fcd-42a1-3638-1a4033007863 21ms
[INFO ] 2020-06-06T18:19:57.631Z [sync:New] Saved to cache no error
[INFO ] 2020-06-06T18:19:57.632Z [sync:New] Sync finished no error
[INFO ] 2020-06-06T18:19:57.848Z [launcher] spawn xdotool: 0, 279ms
[INFO ] 2020-06-06T18:19:57.894Z [launcher] spawn xdotool: 0, 37ms
[ERROR] 2020-06-06T18:19:57.984Z [launcher] spawn xdotool: 2, 89ms

Error: Invalid key sequence ']'
Failure converting key sequence ']' to keycodes
Error: Invalid key sequence ']'
Failure converting key sequence ']' to keycodes
xdo_send_keysequence_window reported an error for string ']'
[ERROR] 2020-06-06T18:19:57.985Z [auto-type] Run error Exit code 2

Which version of Debian and xdotool and debian is it? I'm trying to reproduce it, but it works for me.

I just downloaded the installer (10.4.0) and installed it ~1h ago, so should be all the newest versions available in the default mirrors:

test@debian:~$ xdotool --version
xdotool version 3.20160805.1
test@debian:~$ neofetch
       _,met$$$$$gg.          test@debian 
    ,g$$$$$$$$$$$$$$$P.       ----------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 10 (buster) x86_64 
 ,$$P'              `$$$.     Host: KVM/QEMU (Standard PC (i440FX + PIIX, 1996) pc-i440fx-5.0) 
',$$P       ,ggs.     `$$b:   Kernel: 4.19.0-9-amd64 
`d$$'     ,$P"'   .    $$$    Uptime: 14 mins 
 $$P      d$'     ,    $$P    Packages: 1594 (dpkg) 
 $$:      $$.   -    ,d$$'    Shell: bash 5.0.3 
 $$;      Y$b._   _,d$P'      Resolution: 1024x768 
 Y$$.    `.`"Y$$$$P"'         DE: GNOME 3.30.2 
 `$$b      "-.__              Theme: Adwaita [GTK2/3] 
  `Y$$                        Icons: Adwaita [GTK2/3] 
   `Y$$.                      Terminal: gnome-terminal 
     `$$b.                    CPU: Common KVM (1) @ 2.903GHz 
       `Y$$b.                 GPU: Red Hat, Inc Virtio GPU 
          `"Y$b._             Memory: 1004MiB / 3946MiB 
              `"""
                                                      

I have the same, now how do you trigger auto-type?

Via the normal global shortcut: alt-shift-T .

Well, I was doing it differently. Does it work if you trigger auto-type from keeweb with Ctrl-T?

I can repeat it the way you describe, but it works if I call auto-type from KeeWeb.

Looks like it has something to do with the target window. If I trigger auto-type on a browser, it behaves as you describe; if I do it on the terminal, it doesn't auto-type anything at all. Weird... So you're right, it's not fixed, I'll try to see what else can be done.

Okay. Thanks a lot!

Actually I never used the Auto-Type from KeeWeb, but it seems to somehow work, or at least there isn't any xdotool error, so that's good. I currently have an other issue with that method, that it types random stuff and I end up with bookmarking the page instead of logging in, but that might be an issue of my configuration. I need to look into what's happening there.

hèhè, xdotool doesn't like if stdin doesn't end with \n and it seems to just read memory further and type what's there or fail because of wrong memory access, now I think I've finally fixed it, a release is coming soon.

v1.15.2 is released, let's give it a try!

It works (for me). Thanks a lot! Now I can use auto-type again.

Was this page helpful?
0 / 5 - 0 ratings