Repository navigation
Conversation
A token whose model has an expires_at value is rejected once that time has passed. The inactivity expiry from expires_in still applies, and the earlier of the two ends the session. A nil value, or a model without the column, behaves as before. Release 1.9.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
json 3 dropped the quirks_mode keyword that ActiveSupport 7.2 and 8.0 still pass to JSON.generate, so every Devise 401 JSON body raised and became a 500. Rails 8.1 no longer passes it and keeps json 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
murilooon
marked this pull request as ready for review
November 24, 2026 21:14
Member
Author
|
Closing: we're dropping the trusted/tiddle fork. Upstream tiddle 1.9.0 has the same code, and the fixed-expiry check moves into the identity engine (trusted/rails-identity-service#98). |
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.
What
Devise::Strategies::TokenAuthenticatable#unexpired?now rejects a token whose model has anexpires_atvalue onceTime.current > expires_at.last_used_at + expires_in) still applies. Whichever expiry comes first ends the session.expiration_disabled?early return. So a token with noexpires_inis still rejected after itsexpires_at.expires_at, or a token model without the column, behaves exactly as before.version.rband a README section onexpires_at.Why
Asana: https://app.asana.com/1/303134204339906/project/1220308862188378/task/1220303649568339
This is part of Works session expiration, Phase 1: every session ends at a fixed time decided at sign-in. Works will set
expires_atthrough Tiddle'smetadata:when it issues a token. Theidentity_auth_tokenscolumn ships separately, in WORK-11508. Until both ship, Works behaves as it does today.Note for the Works bump (WORK-11944): Works pins
947151d, which is not an ancestor of the currentmain.mainwas rewritten in July: #5, #6 and #7 were squashed into98e986d. So the bump also brings in98e986d: hash-styleauthentication_keyssupport, andrequired_ruby_version >= 3.3/activerecord >= 7.2, which Works already meets.Verification
BUNDLE_GEMFILE=gemfiles/rails8.1.gemfile bundle exec rake(rubocop + specs, ActiveRecord)strategy.rbchange revertedexpires_at, no touch, pastexpires_atwhileexpires_inhas not passed)rakelocally ongemfiles/rails7.2.gemfileandrails8.0.gemfile(after the json pin below)New specs cover:
expires_atin the future and in the pastexpires_atwithexpires_innot yet reachedexpires_atwith the inactivity period already passedexpires_at, with the sliding expiry still enforcedCI fix: json below 3 for Rails 7.2 and 8.0
CI had drifted since July, and this change did not cause it.
json3.x dropped thequirks_mode:keyword, which ActiveSupport 7.2.3 and 8.0 still pass toJSON.generate. So every Devise 401 JSON body raisedArgumentError, the request returned a 500, and every spec that expects a 401 failed. Plainorigin/mainfails the same way. Rails 8.1 no longer passes the keyword, so its jobs stayed green.The fix pins
gem "json", "< 3"ingemfiles/rails7.2.gemfileandgemfiles/rails8.0.gemfileonly. It is test-only and does not touch the gemspec. Works runs Rails 8.1 with json 2.21.2, so it is not affected.Security review
The security review (Works
security-reviewskill on this diff) found no vulnerabilities.expires_atfalls back to the existing check. A pastexpires_atis checked first and denies.expires_atis written only by the server throughmetadata. No request input reaches it.Reviews
purge_old_tokenskeeps tokens by newestlast_used_at, so a token pastexpires_atcan outrank a live idle one for users with more than 20 tokens; pre-existing code, left as a follow-up)🤖 Generated with Claude Code