-
Notifications
You must be signed in to change notification settings - Fork 60
fix: certain YubiKeyDevice properties were not being updated in the YubiKeyDevice #348
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
Conversation
- Ensured `_yubiKeyDeviceInfo` reflects updated configurations such as timeouts, flags, and restrictions. - Added property assignments to maintain consistency with the device state after changes. fixes: #192
…nfiguration changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where device configuration properties were not updated immediately after being changed via API calls, requiring a device re-enumeration to see the changes. The fix updates the in-memory cached properties immediately after successful configuration commands. Additionally, the PR strengthens integration tests to verify this immediate update behavior and improves API documentation to clearly describe when properties are updated.
- Implemented immediate property updates in the device API after configuration changes
- Added comprehensive integration tests verifying immediate property updates for all affected properties
- Enhanced XML documentation to clarify property update timing and requirements
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Yubico.YubiKey/src/Yubico/YubiKey/YubiKeyDevice.Instance.cs | Added immediate property updates after successful configuration commands for ChallengeResponseTimeout, AutoEjectTimeout, IsNfcRestricted, DeviceFlags, and ConfigurationLocked |
| Yubico.YubiKey/src/Yubico/YubiKey/IYubiKeyDevice.cs | Enhanced XML documentation to specify that properties update immediately after configuration changes and clarified method requirements |
| Yubico.YubiKey/tests/integration/Yubico/YubiKey/YubiKeyDeviceTests.cs | Refactored existing tests to use SkippableFact/SkippableTheory and added new tests verifying immediate property updates; replaced TryGetSkyDevice with GetSkyDevice for clearer error handling |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@claude Can you address the failing build regarding XML docs? |
|
Claude finished @DennisDyallo's task —— View job Fixed XML Documentation Build Errors ✓I've successfully fixed the XML documentation errors that were causing the build to fail. Tasks
Issues FixedThe build was failing due to unresolved
The review comment about "unrestrict" vs "allow NFC" terminology was already addressed in the existing code. Changes CommittedThe fixes have been committed and pushed to the |
Fix unresolved XML documentation references by fully qualifying property names with their interface (IYubiKeyDeviceInfo) in cref attributes: - ChallengeResponseTimeout - AutoEjectTimeout - ConfigurationLocked (2 occurrences) - IsNfcRestricted This resolves CS1574 compilation errors in the documentation build. Co-authored-by: Dennis Dyallo <DennisDyallo@users.noreply.github.com>
Test Results: Windows 2 files 2 suites 16s ⏱️ Results for commit cdb58df. |
Test Results: Ubuntu 2 files 2 suites 48s ⏱️ Results for commit cdb58df. |
Test Results: MacOS 4 files 4 suites 32s ⏱️ Results for commit cdb58df. |
|
@claude What's your take on this PR? |
|
Claude finished @DennisDyallo's task —— View job Code Review: Property Update ImplementationI've reviewed the PR changes that fix the issue where certain YubiKeyDevice properties weren't being updated immediately after configuration changes. Here's my comprehensive assessment: Overall Assessment: Strong Implementation ✓This PR addresses GitHub Issue #192 effectively by ensuring device properties reflect their new values immediately after configuration changes, without requiring device re-enumeration. The implementation is clean, well-tested, and properly documented. What Works Well1. Correct Implementation Pattern ✓The property update pattern is consistent and well-placed across all configuration methods in // Lines 377-381, 405-408, 428-431, 449-452, 486-489, 518-521
if (_yubiKeyDeviceInfo is YubiKeyDeviceInfo deviceInfo)
{
deviceInfo.PropertyName = newValue;
}This pattern:
2. Comprehensive Test Coverage ✓The new integration tests (
Each test follows the pattern: get initial value → change it → verify immediate update → restore → verify restoration. 3. Improved Documentation ✓The XML documentation updates in
4. Better Test Infrastructure ✓The refactoring from
Potential Concerns & Questions1. Thread Safety Consideration
|
This pull request improves the YubiKey device API by ensuring that device properties are updated immediately after configuration changes, and strengthens integration tests to verify this behavior. It also enhances documentation for several methods, clarifying property update timing and requirements.
Immediate Property Update After Configuration Changes
YubiKeyDevice.Instance.csso that properties likeChallengeResponseTimeout,AutoEjectTimeout,IsNfcRestricted,DeviceFlags, andConfigurationLockedare set immediately after their respective configuration methods are called, ensuring the API reflects the latest device state without requiring a refresh. [1] [2] [3] [4] [5] [6]API Documentation Improvements
IYubiKeyDevice.csto clearly state that properties are updated immediately after configuration changes, and to specify requirements and exceptions for each method. [1] [2] [3] [4] [5] [6]Integration Test Strengthening
YubiKeyDeviceTests.csto use[SkippableFact]and[SkippableTheory]for better error handling when devices are not found, and replaced the device retrieval helper with a more robust method. [1] [2] [3] [4] [5] [6]IsNfcRestricted,DeviceFlags,AutoEjectTimeout,ChallengeResponseTimeout,ConfigurationLocked) are updated immediately after configuration changes, addressing GitHub Issue [BUG] IsNfcRestricted needs to be invalidated #192.Test Code Refactoring
TryGetSkyDevicepattern in favor of a direct method that throws if no device is found, improving test reliability and clarity.Limitations
Type of change
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:
Checklist:
dotnet formatto format my codeFootnotes
See Yubikey models (Multi-protocol, Security Key, FIPS, Bio, YubiHSM, YubiHSM FIPS) ↩