Devise 5.0
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
3prompts
- Ruby 4.0124 lines · 4.3K tokens
- Ruby on Rails 8.183 lines · 4.1K tokens
- Devise 5.083 lines · 4K tokens
Total290 lines · 12.4K tokens
CWE Coverage
- 20
- 23
- 59
- 73
- 74
- 78
- 79
- 89
- 95
- 113
- 117
- 122
- 134
- 201
- 208
- 209
- 214
- 250
- 295
- 304
- 306
- 307
- 312
- 319
- 327
- 338
- 347
- 352
- 362
- 367
- 378
- 384
- 409
- 416
- 426
- 434
- 470
- 502
- 521
- 532
- 552
- 601
- 613
- 614
- 620
- 639
- 640
- 749
- 770
- 772
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 942
- 1004
- 1333
- 1395
Prompt Preview
Apply the Ruby 4.0 and Ruby on Rails 8.1 baselines first. These rules cover Devise 5.0 with its standard Active Record and bcrypt integration, plus the boundaries of optional OmniAuth authentication; they were checked against 5.0.4. The gem's Ruby >= 2.7 and Rails >= 7.0 installation requirements do not make end-of-life runtimes suitable for deployment.
Modules, identity, and tenant boundaries
- Enable only required modules in each model and expose only their intended
devise_forroutes. Enable:confirmable,:lockable, and:timeoutableexplicitly when needed; their configuration settings alone do not activate them. - Remove public registration routes for closed enrollment. Keep
:registerabledeclared if retainingRegistrationsControlleredit/update actions, because those actions use its model configuration in Devise 5. - Protect each scope with its matching helper, such as
authenticate_admin!for administrative controllers. An unscopedsigned_in?can succeed for a different Devise model and does not establish the required identity or authorization. - Use
authenticate_user!(force: true)or the corresponding scoped helper for protected actions added to aDeviseControllersubclass; these authentication helpers normally skip enforcement inside Devise controllers. - Implement suspension and eligibility checks through
active_for_authentication?usingsuper && application_condition; preserve Warden's activatable hook so confirmation and lockout checks also run when loading existing sessions. - Recheck tenant membership on every protected request.