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

Make YubiKey::open() more robust #504

Merged
merged 2 commits into from
Aug 15, 2023
Merged

Conversation

hko-s
Copy link
Contributor

@hko-s hko-s commented May 18, 2023

My Notebook contains a physical smart card reader, which caused the YubiKey::open() function to falsely claim that multiple YubiKey are connected (because two Readers exist: one of them being the empty physical reader, the other being an actual YubiKey).

This patch fixes that. I think the change is preferable to the previous code (and it fixes open() on my machine).
However, there is one possible downside (also described in the doc comment):

If two YubiKeys are connected, and one is currently opened (and locked as exclusive), the caller will now receive "the other" YubiKey, with the (somewhat misleading) implication that only one YubiKey is connected to the system. There is no indication that multiple YubiKey are connected, and I can't imagine a reliable way to avoid such a scenario (if there's a card we can't open, I think we also can't find out what kind of card it is).

I assume the new semantics are acceptable (preferable) in most cases. But it might theoretically trip up users who relied on the previous semantics (which I assume happened to work as expected, as long as no non-YubiKey Readers are connected).

hko-s added 2 commits May 18, 2023 14:41
On systems with a physical card-reader, the previous implementation falsely
reports "multiple YubiKeys detected!", even if only one YubiKey is connected.
This change attempts to actually open each reader as a YubiKey, and only
reports "multiple YubiKeys" if it can actually open more than one.

Additionally, this change avoids resetting the YubiKeys in case we find more
than one.
@tony-iqlusion tony-iqlusion merged commit 485d49a into iqlusioninc:main Aug 15, 2023
@tony-iqlusion tony-iqlusion mentioned this pull request Aug 16, 2023
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