You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Preserve absolute password-reset deadlines through token issuance - #1027
Password-reset codes currently depend on cache cleanup for expiration. This change persists their deadline and carries it through authentication as auth.Rec.ExpiresAt. Token issuance caps the encoded expiration at that absolute deadline and rejects an insufficient remaining validity window. A code redeemed with 2.75 seconds remaining cannot produce a valid token after a four-second account lookup.
Token expiration is truncated to its actual whole-second encoding. Login propagates issuance failures before authenticating the session and checks reset-token validity again before replying. Normal authenticated login explicitly renews token validity; reset-only login preserves its deadline.
REST providers receive the absolute deadline as rec.expires_at; issuance rejects missing, expired, or overlong provider expirations. Login independently checks the returned expiration against the original bound. Account creation handles login errors before accessing success parameters, preventing a token-generation failure from panicking {acc login=true}.
Cache retries and consumption use conditional writes, and issuance atomically reclaims expired or legacy records without overwriting concurrent replacements. All four database adapters implement the conditional operations. Codes issued before this change are rejected and can immediately be replaced. Exported additions have Godoc comments.
Validation:
Server and all auth package tests pass, including with the race detector and all four database adapters enabled.
All non-database-integration packages pass with all adapter build tags.
New REST serialization/provider-boundary and account-creation regression tests reproduced both review failures before the fixes and pass afterward. The full server/auth race suite passes with all adapter build tags.
Regression tests cover delayed issuance, encoded deadline bounds, fractional-second validity, real code-to-token issuance, login error propagation, expiry without cleanup, retry limits, concurrent replacement, and conditional consumption.
Live database tests were not rerun for this replacement. The retained atomic cache operations passed disposable MySQL, MongoDB, and RethinkDB tests during the earlier work; PostgreSQL runtime coverage remains unavailable.
Replaces closed PR #1023, with a fresh commit based on devel.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Security-sensitive changes across four database adapters warrant human review, with PostgreSQL runtime coverage unavailable and an account-creation panic still unresolved.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Authentication timing and cross-database atomicity require human review, with an unresolved login timing issue and unavailable live PostgreSQL coverage.
Token issuance now precedes the synchronous device update, but the final expiration check only covers FeatureNoLogin. An ordinary login with a valid two-second token lifetime and a four-second store.Devices.Update returns 200 with an already-expired token and an authenticated session; previously the token was generated after that write. Please perform device storage before issuing the token and authenticating the session, or ensure ordinary tokens remain usable before committing session state and replying.
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
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.
Password-reset codes currently depend on cache cleanup for expiration. This change persists their deadline and carries it through authentication as
auth.Rec.ExpiresAt. Token issuance caps the encoded expiration at that absolute deadline and rejects an insufficient remaining validity window. A code redeemed with 2.75 seconds remaining cannot produce a valid token after a four-second account lookup.Token expiration is truncated to its actual whole-second encoding. Login propagates issuance failures before authenticating the session and checks reset-token validity again before replying. Normal authenticated login explicitly renews token validity; reset-only login preserves its deadline.
REST providers receive the absolute deadline as
rec.expires_at; issuance rejects missing, expired, or overlong provider expirations. Login independently checks the returned expiration against the original bound. Account creation handles login errors before accessing success parameters, preventing a token-generation failure from panicking{acc login=true}.Cache retries and consumption use conditional writes, and issuance atomically reclaims expired or legacy records without overwriting concurrent replacements. All four database adapters implement the conditional operations. Codes issued before this change are rejected and can immediately be replaced. Exported additions have Godoc comments.
Validation:
Replaces closed PR #1023, with a fresh commit based on devel.