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

Fix/catch device removal error from fido2 lib #203

Merged
merged 1 commit into from
Jan 25, 2024
Merged

Conversation

daringer
Copy link
Collaborator

Nitrokey3Device.list() and the underlying fido2-library is very flaky during connect/disconnect operations and a regular error thrower, thus after trying with catching only OSError the newly found issue involves a thrown Exception 🙄

  File "lib/python3.10/site-packages/fido2/hid/__init__.py", line 261, in list_devices
    yield cls(d, open_connection(d))
  File "lib/python3.10/site-packages/fido2/hid/__init__.py", line 112, in __init__
    raise Exception("Wrong nonce")
Exception: Wrong nonce

So this PR catches all Exceptions thrown by it and cancels the remove_device operation, which is anyways triggered multiple times so canceling the "bad" ones is fine here.

@daringer daringer merged commit 344a9a4 into main Jan 25, 2024
10 checks passed
@daringer daringer deleted the fix-dev-remove branch January 25, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants