Repository navigation
Use the factory clock in token expiry checks - #8793
Merged
Merged
Conversation
quexten
force-pushed
the
fix-2fa-remember-test-clock
branch
2 times, most recently
from
November 2, 2026 12:16
818d885 to
f49d2ae
Compare
The remember token factory stamps ExpirationDate from an injected TimeProvider, but ExpiringTokenable.IsExpired read DateTime.UtcNow. A token created with a fixed test clock was judged against the real one, so the factory test started failing on 2026-11-01 when its 30 day token passed its expiry. Let a factory pass its clock to the token it creates. Tokens that are deserialized keep using the system clock.
quexten
force-pushed
the
fix-2fa-remember-test-clock
branch
from
November 2, 2026 12:19
f49d2ae to
cb804d7
Compare
quexten
marked this pull request as ready for review
November 2, 2026 12:21
quexten
enabled auto-merge (squash)
November 2, 2026 12:22
ike-kottlowski
approved these changes
Nov 2, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8793 +/- ##
==========================================
- Coverage 68.26% 68.25% -0.01%
==========================================
Files 2742 2742
Lines 117709 117711 +2
Branches 10692 10692
==========================================
- Hits 80353 80349 -4
- Misses 34816 34823 +7
+ Partials 2540 2539 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎟️ Tracking
No ticket.
📔 Objective
TwoFactorRememberTokenableFactorystampsExpirationDatefrom an injectedTimeProvider, butExpiringTokenable.IsExpiredreadsDateTime.UtcNow.TwoFactorRememberTokenableFactoryTestsfixes the clock at 2026-10-02, so its 30 day token expired on 2026-11-01 and the test has failed on every PR since. Introduced in #8427.ExpiringTokenablenow has an internalTimeProvider(system clock by default, not serialized). The factory sets it to its own clock on the tokens it creates. Deserialized tokens still use the system clock.