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

Add device reset command #110

Merged
merged 3 commits into from
Jun 27, 2024
Merged

Add device reset command #110

merged 3 commits into from
Jun 27, 2024

Conversation

AdamVe
Copy link
Member

@AdamVe AdamVe commented Jun 25, 2024

Description

Adds command for device reset

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Test configuration:

  • Firmware version:
  • Yubikey model:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have run dotnet format to format my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link

github-actions bot commented Jun 25, 2024

Test Results: Windows

    2 files      2 suites   4s ⏱️
3 700 tests 3 700 ✅ 0 💤 0 ❌
3 702 runs  3 702 ✅ 0 💤 0 ❌

Results for commit f1fedc1.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jun 25, 2024

Test Results: Ubuntu

    2 files      2 suites   9s ⏱️
3 692 tests 3 692 ✅ 0 💤 0 ❌
3 694 runs  3 694 ✅ 0 💤 0 ❌

Results for commit f1fedc1.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jun 25, 2024

Test Results: MacOS

    2 files      2 suites   3s ⏱️
3 692 tests 3 692 ✅ 0 💤 0 ❌
3 694 runs  3 694 ✅ 0 💤 0 ❌

Results for commit f1fedc1.

♻️ This comment has been updated with latest results.

@DennisDyallo
Copy link
Collaborator

Is this ready for review @AdamVe ?

@AdamVe AdamVe marked this pull request as ready for review June 26, 2024 11:56
@DennisDyallo DennisDyallo self-requested a review June 26, 2024 14:05
@DennisDyallo
Copy link
Collaborator

LGTM!

Copy link
Collaborator

@DennisDyallo DennisDyallo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DennisDyallo DennisDyallo added the enhancement New feature or request label Jun 26, 2024
Copy link

Code Coverage

Package Line Rate Branch Rate Complexity Health
Yubico.Core 42% 31% 4257
Yubico.YubiKey 51% 47% 18867
Summary 49% (31972 / 65274) 45% (8176 / 18345) 23124

Minimum allowed line rate is 40%

@DennisDyallo DennisDyallo merged commit 6a8b397 into develop Jun 27, 2024
13 checks passed
@DennisDyallo DennisDyallo deleted the adamve/device_reset branch June 27, 2024 07:55
@DennisDyallo DennisDyallo mentioned this pull request Jun 28, 2024
@@ -74,6 +74,11 @@ public enum YubiKeyFeature
/// </summary>
TemporaryTouchThreshold,

/// <summary>
/// The YubiKey supports proprietary reset.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AdamVe what does "proprietary" mean here exactly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! The propietary in here is referring to a function of the YubiKey which is only available on the YubiKey (and is not part of the PIV standard). The reasoning is:

When both applications (FIDO and PIV) are enabled AND configured with credentials, a Yubico proprietary factory reset will be the only way to reset both FIDO and PIV, simultaneously.

Maybe instead of "proprietary" it is better to use "device wide factory" because it will reset all the applications (FIDO and PIV in this context) on the device:

The YubiKey supports device wide factory reset.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, interesting. So does this mean that a reset that only affects the PIV application (Yubico.YubiKey.Piv.PivSession.ResetApplication) adheres to the PIV standard?

And if this reset only affects the FIDO and PIV applications, shouldn't we specify that? When I read "device-wide", I would assume that affects all YubiKey applications (Yubico OTP, etc).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I have forgotten to mention that this instruction is available only on YubiKey Bio Multi-Protocol Edition devices. There are only FIDO and PIV application available on these devices. These application share the PIN and the fingerprint sensor (you can use the same pin/fingerprints for both FIDO and PIV authentication) which causes that you cannot reset the PIV or FIDO applications with the "PivSession.ResetApplication" (and vice versa for FIDO) because it would invalidate the other application as well. That is why the device wide reset was created - it will reset all the applications on the YubiKey (currently FIDO and PIV).

Once you do some setup of FIDO (for example add passkeys) or PIV (for example import a certificate), the PivSession.ResetApplication (or the FIDO reset) will not be possible to call because of the reason I described in the previous paragraph. The only way how to reset such YubiKey is to use the device wide reset.

I think it should be added to the documentation that this is available only on YubiKey Bio MPE.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, I didn't know that!

I added some additional info about the DeviceReset in my PR in this commit: 3b234d5. Let me know if this covers it sufficiently.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! That is much better. I added a comment there to clarify a detail. Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants