Rails 8 upgrade prep: fix otp_enc_key, advance load_defaults to 7.2 - #1299
Merged
Conversation
philayres
force-pushed
the
otp-secret-key-base-1015
branch
3 times, most recently
from
July 23, 2026 18:37
97b578d to
48970c4
Compare
This was referenced Jul 30, 2026
Closed
philayres
force-pushed
the
otp-secret-key-base-1015
branch
from
August 5, 2026 09:40
48970c4 to
a252712
Compare
added 4 commits
August 6, 2026 12:38
philayres
force-pushed
the
otp-secret-key-base-1015
branch
from
August 6, 2026 11:43
a252712 to
1ec9b00
Compare
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.
Summary
First tranche of work for #1015 (Rails 8 + Puma 8 upgrade prep). This PR stays on Rails 7.2.3.1 - no gem version bump yet - and focuses on the pre-bump code fix plus advancing
config.load_defaultsfrom 7.0 to 7.2, per the staged plan agreed in #1015 (isolate config-default changes from the major-version bump).Changes
otp_enc_keyfallback (app/models/concerns/standard_authentication.rb) -Rails.application.secretswas removed from Rails; replaced withRails.application.secret_key_base. Confirmed via spec that the old code raisedNoMethodErrorwheneverDevise.secret_keywas falsy.config.load_defaults7.0 -> 7.2 (config/application.rb) - removed the now-stalenew_framework_defaults_7_0.rb/new_framework_defaults_7_2.rbinitializer files (superseded by the load_defaults bump); preserved theconfig.yjit = truesetting.active_record.postgresql_adapter_decode_dates = false(tracked: Adopt active_record.postgresql_adapter_decode_dates = true (currently overridden to false) #1295)active_job.enqueue_after_transaction_commit = :never(tracked: Adopt active_job.enqueue_after_transaction_commit = :default (currently overridden to :never) #1296)otp_secret, dynamic model fields markedencrypted: true). Without a fallback, all existing SHA1-encrypted production data (every user's 2FA secret) would become undecryptable. Addedconfig.active_record.encryption.support_sha1_for_non_deterministic_encryption = trueto keep SHA1 as a decrypt-only previous scheme (tracked: Migrate OTP encrypted field (otp_secret) to SHA256 hash digest #1293).attr_readonly,default_column_serializer, cache expiration validation, security headers, HTML sanitizer vendor, autoload paths) - no further code changes needed; findings posted as a comment on Upgrade to Rails 8 #1015.Testing
otp_enc_keyfallback and for SHA1-legacy-data decryption compatibility (RED/GREEN demonstrated for both).standard_authentication_spec.rb,user_otp_secret_decryption_spec.rb,admin_otp_secret_decryption_spec.rb,dynamic_model_encrypted_fields_spec.rb, migration generator/dynamic migration specs, Redcap job specs,tag_formatter_spec.rb,e_signature_manager_spec.rb.Not in scope for this PR
new_framework_defaults_8_0.rbFollow-up issues
postgresql_adapter_decode_dates = trueonce raw-SQL paths are auditedenqueue_after_transaction_commit = :defaultonce delayed_job commit-timing is validated in stagingRefs #1015