solokeys / solo1-cli

Solo 1 library and CLI in Python
https://pypi.org/project/solo-python
Apache License 2.0
183 stars 69 forks source link

Ignore ValueError from fido2 ParseUevent. #118

Closed enrikb closed 3 years ago

enrikb commented 3 years ago

As reported in #117, there can be lines in Linux hidraw sysfs files for certain devices (maybe broken? or is it a kernel issue?) missing an '=' sign.

The fido2 ParseUevent() method fails if it hits a line missing the '=' in the uevent sysfs file and solo aborts due to an unhandled exception.

As solo-python already live patches the method, add a try-except to the call of the original method and ignore the ValueError thrown in such a situation. The same is applied to the split() call in this method.

Closes #117.

nickray commented 3 years ago

OK. gonna trust you on this one :) Just to clarify before merging, this is independent of a possible python-fido2 bump?

enrikb commented 3 years ago

If python-fido2 would be updated this fix would be obsolete, but the whole ParseUevent replacement would become obsolete, as well. Yes, in that sense it is independent :-)

nickray commented 3 years ago

Thanks folks! Volunteers to update to fido2 0.9? :grin:

pilou- commented 3 years ago

@nickray I started that: https://github.com/pilou-/solo-python/tree/update_fido2 (the windows and macOS parts are missing).

enrikb commented 3 years ago

@pilou, you might want to have a look at Yubico/python-fido2#113, which just got merged. Hopefully, it can help to avoid a few local changes of python-fido2.

innir commented 3 years ago

@pilou- I tested your patch and it works except I'm not able to update the firmware :-/

[OS: Debian, testing 64bit; solo-python 0.0.27 + your patch]

$ solo key version
4.1.0 locked

$ solo key update
Wrote temporary copy of firmware-4.1.2.json to /tmp/tmpihv02s9z.json
sha256sums coincide: 22b2efdc75a716641d4555cbeff4d53b026ddf816689ccadf340b3b87634adaa
Switching into bootloader mode...
using signature version <=2.5.3
erasing firmware...
Could not switch into bootloader mode.
Please put key into bootloader mode:
1. Unplug key
2. While holding button, plug in key for 2s

Do what I'm asked for ...

$ solo key update

Unhandled error connecting to key.
Please report via https://github.com/solokeys/solo-python/issues/

Updating via https://update.solokeys.com/ worked (I still have one key that is not updated to test ;-))

[Context why I'm interested: https://github.com/solokeys/solo-python/issues/110#issuecomment-802945287]