heartcombo/devise
65.2
Adequate · 14 November 2026
5.8k
lines of production code
Ruby
primary language
7
measurements over time
What this system is
This system is the Devise authentication framework for Ruby on Rails, providing a modular suite of components for user registration, login, password recovery, and account management. It integrates with Warden to handle session management and supports multiple ORMs like ActiveRecord and Mongoid, along with OmniAuth for social logins. The system includes configurable mailers for notifications, customizable controllers and views, and comprehensive test helpers to facilitate integration and unit testing.
How it got here
2009 — Initial framework release and modularization
23 changes.
This period marks the initial release of the Devise authentication framework, establishing its core configuration, modular component structure, and Rails integration. The work focused on building a flexible, composable architecture with support for multiple ORMs and comprehensive test coverage across models, controllers, and integration scenarios. Security hardening and backward compatibility measures were also implemented alongside the foundational feature set.
2010 — HTML5 UX and ORM expansion
22 changes.
This period focused on modernizing the user interface by updating all authentication views to use HTML5 attributes, semantic structure, and Hotwire/Turbo compatibility. It also expanded framework support by introducing dedicated generators and test infrastructure for Mongoid, while refactoring default controllers to better handle non-navigational API requests.
2011–2023 — Modernization and testing infrastructure
18 changes.
The project modernized its authentication views and controllers by integrating Hotwire/Turbo support, improving browser autocomplete attributes, and introducing Markdown email templates. Concurrently, it significantly expanded testing capabilities by adding dedicated helper modules for controller and integration tests, alongside comprehensive support for newer Rails versions and dependency updates.
Features
Add simple\_form confirmation resend template with autofocus
A new template for the confirmation resend page has been added to the simple\_form\_for generator. This template renders a form for resending confirmation instructions, featuring an email input field that is set to autofocus and pre-fills with the user's current or unconfirmed email address. It also displays validation errors for the confirmation token and includes a link to shared navigation links.
_lib/generators/templates/simple\_form\for/confirmations · high confidence
Added Markdown email templates for Devise notifications
The generator now includes a new set of email templates in the Markerb format (Markdown), providing users with an alternative to the default ERB templates. These new templates cover all standard Devise notification types: confirmation instructions, email change notifications (which correctly display the unconfirmed email when applicable), password change, password reset instructions, and account unlock. This allows users to generate Markdown-based email views directly from the generator.
lib/generators/templates/markerb · high confidence
Initial release of Devise authentication framework
This commit introduces the core configuration and module structure for the Devise authentication gem. It establishes the \Devise\ module with autoloads for key components such as strategies, controllers, mailers, and test helpers. It defines the default configuration options for authentication, including email validation regex, password length constraints, session timeout intervals, and cookie settings, providing the foundational setup for integrating authentication into Rails applications.
lib · high confidence
Introduce Devise Rails integration modules
This change adds the core Rails integration files for Devise. The new \lib/devise/rails/routes.rb\ file extends the Rails \ActionDispatch::Routing::Mapper\ to provide the \devise\_for\ method, which automatically generates authentication routes (sessions, passwords, confirmations, etc.) based on the configured modules in the user model, and hooks into the route finalization process to configure Warden and regenerate helpers. Additionally, \lib/devise/rails/warden\_compat.rb\ is added to provide compatibility shims for Warden, ensuring that the \request\, \reset\_session!\, and \cookies\ methods are correctly mapped to the ActionDispatch request environment.
lib/devise/rails · high confidence
Introduction of Devise::Mailer class with configurable parent mailer
A new \Devise::Mailer\ class has been added to handle authentication-related emails (confirmation, reset password, unlock, email change, and password change). This implementation allows the parent mailer to be customized via \Devise.parent\_mailer\, enabling inheritance and flexibility for engines or custom mailer setups. The mailer includes helper modules and supports passing options to the underlying \devise\_mail\ method.
app/mailers · high confidence
Introduction of modular authentication components
Devise now structures its authentication logic into distinct, composable modules (Authenticatable, Confirmable, DatabaseAuthenticatable, Lockable, Omniauthable, Recoverable, Registerable, Rememberable, Timeoutable, Trackable, and Validatable). This modular design allows users to include only the specific features they need in their models, simplifying configuration and enabling more flexible, fine-grained control over authentication, authorization, and user management behaviors.
lib/devise/models · high confidence
New ActiveRecord-specific Devise generator
A new generator class for ActiveRecord has been introduced to handle the creation of Devise migrations and model modifications. This generator intelligently selects between creating a new migration or modifying an existing one based on whether the model already exists, and it supports namespaced models with correct indentation. It also detects PostgreSQL databases to generate appropriate inet columns for IP tracking fields and allows users to specify a custom primary key type via a command-line option.
_lib/generators/active\record · high confidence
New controller templates for customizing Devise authentication flows
The generator now provides ready-to-use controller templates for confirmations, omniauth callbacks, passwords, registrations, sessions, and unlocks. These templates inherit from Devise's base controllers and include commented-out hooks for common customizations, such as permitting extra parameters via the parameter sanitizer or overriding post-action redirect paths. A README is also included to guide users on configuring routes to point to these custom controllers.
lib/generators/templates/controllers · high confidence
New generators for custom controllers and scoped views
Devise now includes a \devise:controllers\ generator that allows users to create inherited controller classes for specific scopes (e.g., \users/sessions\_controller.rb\) to customize authentication behavior. Additionally, the views generator has been refactored to support scoped view directories, enabling users to generate views for specific namespaces (e.g., \app/views/users/devise/...\) and select specific view directories to copy. The install generator now explicitly requires an ORM to be configured, raising a clear error if none is found.
lib/generators/devise · high confidence
Support for multiple ORMs via adapter-based hooks
Devise now supports multiple Object-Relational Mappers (ORMs) by introducing specific ORM adapter files for ActiveRecord and Mongoid. These new files utilize ActiveSupport's on\_load hooks to extend the respective ORM models with Devise::Models only when the ORM is loaded, replacing the previous single-ORM approach and allowing for greater flexibility in ORM selection.
lib/devise/orm · high confidence
Security
Devise 5.0.4 release with security fixes and BCrypt defaulting
This release updates Devise to version 5.0.4, which includes a security fix for a race condition vulnerability by ensuring the \unconfirmed\_email\ is always saved. It also changes the default password encryptor to BCrypt and automatically adds a pepper during generation. The release notes indicate this version addresses a timeoutable security advisory.
lib/devise · high confidence
Release v5.0.4 with security fixes for open redirect and race condition vulnerabilities
This release addresses two security vulnerabilities: [CVE redacted], which fixes an open redirect in the FailureApp via an unvalidated Referer header on non-GET session timeouts, and [CVE redacted], which resolves a race condition in the confirmable module that could allow users to confirm an email address they do not own. The changelog also documents the previous v5.0.3 release, which included enhancements for customizing sign-in behavior after password changes and reset actions.
(repo-wide) · high confidence
Behavioural changes
Add unlock token error display to resend unlock instructions form
The generator template for the unlock resend page now explicitly displays validation errors for the unlock token using \f.full\_error :unlock\_token\, ensuring users see specific feedback if the token is invalid or missing. The form also retains autofocus on the email field and renders the shared links partial.
_lib/generators/templates/simple\_form\for/unlocks · high confidence
Empty DeviseHelper stub added for backward compatibility
An empty DeviseHelper module has been added to app/helpers/devise\_helper.rb to serve as a placeholder for backward compatibility. This change ensures that existing code referencing DeviseHelper does not break, while the actual implementation of error message rendering has been moved elsewhere (as indicated by the 'Keeping the helper around for backward compatibility' comment and the empty module body).
app/helpers · high confidence
Introduction of a centralized DeviseController base class
All Devise controllers now inherit from a new \DeviseController\ base class, which centralizes common functionality such as resource management, flash message handling, and navigational format checks. This change ensures consistent behavior across authentication controllers, improves performance through scoped views, and provides a single point for customization via the \Devise.parent\_controller\ configuration.
app/controllers · high confidence
Mongoid Devise generator now excludes trackable fields by default
The Mongoid-specific Devise generator has been updated to no longer include the 'trackable' module fields (such as sign-in counts and IP addresses) in the generated model code. These fields are now commented out, meaning users generating Devise models with Mongoid will no longer automatically get tracking columns in their database schema, aligning the default behavior with the decision to remove trackable from the standard modules.
lib/generators/mongoid · high confidence
New default controller implementations for authentication flows
The application now ships with new default implementations for the Devise authentication controllers (Confirmations, OmniauthCallbacks, Passwords, Registrations, Sessions, and Unlocks). These controllers standardize the behavior for user registration, login, password resets, account confirmation, unlocking, and OAuth callbacks. Key behavioral changes include: sign-out now returns a 204 No Content status for non-navigational requests (like JSON/XML) instead of redirecting; password resets can be configured to not automatically sign in the user; and the system now supports non-navigational formats for all authentication-related actions, allowing API clients to receive structured responses rather than HTML redirects.
app/controllers/devise · high confidence
New migration templates for existing models
The generator now includes a dedicated template (\migration\_existing.rb\) for adding Devise to an already existing model. This template uses \change\_table\ to add necessary columns and indexes, and explicitly raises an \IrreversibleMigration\ in the \down\ method to prevent accidental data loss during rollback, addressing the previous behavior where the standard create-table template might have been used incorrectly for existing schemas.
_lib/generators/active\record/templates · high confidence
Redesign password reset and change views with improved UX and accessibility
The password reset (new) and password change (edit) views have been updated to improve user experience and accessibility. The email field now uses the HTML5 email input type with autofocus and autocomplete set to 'email', while password fields use autocomplete='new-password' to assist password managers. The edit view now displays the minimum password length requirement as a hint. Both forms use semantic HTML5 structure with div wrappers for fields and explicit HTTP methods (POST for reset, PUT for change) to ensure correct behavior across browsers.
app/views/devise/passwords · high confidence
Redesigned confirmation resend form with improved UX and security
The confirmation resend page has been updated to use a modern HTML5 form structure, replacing previous markup with semantic divs and paragraph tags. The email input field now includes HTML5 autofocus and autocomplete attributes to improve user experience, and the form explicitly enforces the POST method. Additionally, the view now renders error messages via a shared partial and includes links to other authentication actions, while also addressing a potential security leak in the email reconfirmation flow by correctly handling unconfirmed email display.
app/views/devise/confirmations · high confidence
Redesigned unlock instructions resend form with HTML5 features
The unlock instructions resend page has been updated to use a new scoped view structure. The form now explicitly sets the HTTP method to POST, includes an autofocus attribute on the email field for improved user experience, and adds autocomplete support for email addresses. Additionally, the layout has been adjusted to use paragraph tags for labels and a div for the field container, replacing previous structural elements.
app/views/devise/unlocks · high confidence
Refactor authentication modules into Warden hooks
The authentication logic for activatable, CSRF cleaning, forgetable, lockable, rememberable, timeoutable, and trackable features has been moved from the model layer into dedicated Warden hooks in lib/devise/hooks. This change ensures that behaviors like session timeout, sign-in tracking, and account activation checks are applied consistently via the Warden middleware stack on every request, rather than relying solely on model callbacks. It also introduces a Proxy class to handle remember/forget actions within these hooks and adds a CSRF cleaner hook to reset tokens on authentication for Rails 7.1+ compatibility.
lib/devise/hooks · high confidence
Refactored Devise shared views to use partials and Hotwire/Turbo compatibility
The shared views for Devise have been refactored to improve structure and compatibility with Hotwire/Turbo. The error messages are now rendered via a dedicated partial (\\_error\_messages.html.erb\) that wraps the explanation in a \div\ with \data-turbo-temporary\ to prevent Turbo cache issues. Additionally, the navigation links have been moved to a new \\_links.html.erb\ partial, and OmniAuth sign-in buttons now use \button\_to\ with \data: { turbo: false }\ to ensure POST requests are handled correctly by Turbo.
app/views/devise/shared · high confidence
Refactored OmniAuth strategy loading and URL helper delegation
The OmniAuth integration now uses a dedicated configuration class to intelligently load strategies by searching registered OmniAuth strategies or autoloading them from the \OmniAuth::Strategies\ namespace, raising a clear error if a strategy is not found. Additionally, URL helpers for authorization and callbacks have been refactored to delegate directly to the router's internal route context, ensuring consistent path generation and resolving issues with undefined helpers.
lib/devise/omniauth · high confidence
Refactored authentication helpers into modular controller modules
The authentication logic in \lib/devise/controllers\ has been reorganized into distinct, reusable modules (\Helpers\, \SignInOut\, \StoreLocation\, \Rememberable\, \ScopedViews\, \Responder\, and \UrlHelpers\). This refactoring introduces specific capabilities: \SignInOut\ now handles sign-in and sign-out mechanics with session expiration; \StoreLocation\ manages redirect paths while preserving URL fragments and query strings; \Rememberable\ provides cookie-based persistence; \ScopedViews\ enables view namespacing by resource; and \Responder\ configures default HTTP statuses for better Hotwire/Turbo integration. Users benefit from a more modular architecture that allows for easier customization of authentication flows and improved compatibility with modern Rails features.
lib/devise/controllers · high confidence
Refactored authentication strategies with new base class and HTTP auth support
The authentication strategy layer has been restructured to improve flexibility and security. A new \Devise::Strategies::Base\ class now handles scope mapping and CSRF storage logic, while \Devise::Strategies::Authenticatable\ serves as the foundation for all authentication strategies, introducing support for HTTP Basic Authentication via the \Authorization\ header in addition to standard params-based login. The \DatabaseAuthenticatable\ strategy has been updated to use this new base, enforcing password presence checks and supporting paranoid mode to mitigate user enumeration attacks. Additionally, the \Rememberable\ strategy is now a distinct strategy that runs before authentication, handling cookie-based session restoration and CSRF cleanup prevention on GET requests.
lib/devise/strategies · high confidence
Refactored mailer logic into a shared helpers module
The mailer functionality has been extracted into a new \Devise::Mailers::Helpers\ module, which is included in the main mailer. This change introduces the \devise\_mail\ helper method to streamline sending emails and makes internal attributes like \scope\_name\ and \resource\ protected rather than public. It also ensures that default \from\ and \reply\_to\ headers set in custom mailers are correctly prioritized over the defaults, and updates the code to use the \frozen\_string\_literal\ pragma.
lib/devise/mailers · high confidence
Updated Devise initializer template and generator documentation
The generated Devise configuration initializer (devise.rb) and its accompanying README have been updated to reflect current defaults and best practices. Key changes include enabling account reconfirmation by default (reconfirmable = true), setting the bcrypt stretching cost to 12 for production and 1 for tests to balance security and performance, and configuring whitespace stripping for email keys. The template also adds support for invalidating all remember-me tokens on sign-out, updates the email validation regex, and clarifies setup requirements for URL options and flash messages in the documentation.
lib/generators/templates · high confidence
Updated default Devise email templates
The default HTML email templates for account confirmation, email changes, password changes, password resets, and account unlocks have been updated. The email change notification now distinguishes between a pending unconfirmed email and a completed change, and the reset password email includes a clearer warning that the password remains unchanged until the link is accessed.
app/views/devise/mailer · high confidence
Updated registration views with HTML5 attributes and Hotwire/Turbo support
The registration views (new and edit) have been updated to use HTML5 email fields with appropriate autocomplete attributes (e.g., 'email', 'new-password', 'current-password') to improve user experience and browser integration. The edit view now displays a message when a user is waiting for email confirmation and includes a minimum password length hint. Additionally, the account cancellation action has been changed from a link to a button, and it now includes \turbo\_confirm\ data attributes to ensure compatibility with Hotwire/Turbo.
app/views/devise/registrations · high confidence
Updated sign-in form with modern HTML5 attributes and consistent styling
The sign-in view now uses the Rails \email\_field\ helper for the email input, enabling browser-specific email validation and improved UX. Autocomplete attributes have been explicitly set to 'email' for the email field and 'current-password' for the password field to assist password managers. The form layout has been refined to use paragraph tags for labels and inputs within field divs, and the button text has been standardized to 'Log in'.
app/views/devise/sessions · high confidence
Updated simple\_form templates for password reset views
The simple\_form\_for generator templates for the password reset flow (new and edit views) have been updated. The edit view now displays the minimum password length hint, sets the autocomplete attribute to 'new-password' for both password fields, and includes autofocus on the password input. The new view sets autocomplete to 'email' on the email input and includes autofocus. Both templates now render the shared links partial from devise/shared/links.
_lib/generators/templates/simple\_form\for/passwords · high confidence
Updated simple\_form\_for registration and session templates
The simple\_form\_for generator templates for registration (new and edit) and session (new) views have been updated. These changes include setting appropriate autocomplete attributes on password and email fields to support modern browser password managers, adding a confirmation status indicator for unconfirmed emails in the edit view, and integrating Hotwire/Turbo support by adding turbo\_confirm data attributes to the account cancellation button.
_lib/generators/templates/simple\_form\for/registrations · high confidence
Test coverage
Add ORM-specific test configuration files for ActiveRecord and Mongoid; Add bin/test executable for Rails 5 Minitest reporting; Add comprehensive test suite for Devise core components; Add dummy Rails application for integration testing; Add test application layout for Devise integration tests; Added ActiveRecord test fixtures for diverse user scenarios; Added Mongoid test models and shim for Devise integration testing; Added Webrat integration support for Rails; Added controller test suite for Devise authentication flows; Added custom Devise mailer classes for testing header configuration; Added custom registrations controller for testing block yields; Added generator tests for Devise components; Added integration test template for Devise bug reports; Added integration tests for authentication modules; Added model unit tests for Devise modules; Added test controllers for the Rails application; Added test coverage for Devise mailer notifications; Added test fixtures for admin views; Added test helper for OmniAuth callback handling; Added test helper modules for Rails app authentication scenarios; Added test support for Rails 4.1 RecordIdentifier compatibility; Added test support for Webrat/Nokogiri compatibility; Added test view templates for home controller actions; Added tests for Devise helper i18n error messages; Added tests for Devise test helpers; Added tests for OmniAuth configuration and URL helpers; New dedicated test helper modules for controller and integration tests; New test support infrastructure for assertions, helpers, and integration testing.
Dependencies
Add dedicated Gemfiles for Rails 7.0, 7.1, 7.2, 8.0, and main
The project now includes specific Gemfile variants for Rails 7.0, 7.1, 7.2, 8.0, and the Rails main branch, enabling targeted testing and dependency resolution for each version. These files pin \responders\ to \\~\> 3.1\, constrain \json\ to \\< 3\ for Rails 7.0/7.1/8.0 to avoid compatibility issues with \ActiveSupport\, and configure Mongoid support (version \\~\> 7.5\ for Rails 7.0, \\~\> 8.1\ for others, or the master branch for Rails main).
gemfiles · high confidence
Devise 5.0.4 updates dependencies for Rails 8.1 and Mongoid 9 support
The gemspec and Gemfile have been updated to require Rails \>= 7.0 (with the test environment targeting Rails 8.1.0) and Ruby \>= 2.7.0. Key dependency changes include upgrading Warden to \~\> 1.2.3, adding Responder \~\> 3.1, and configuring Mongoid \~\> 9.0 (via the 9.0-stable branch) for MongoDB support. The test suite dependencies have also been refreshed, pinning Minitest to \< 6 and updating Mocha to \~\> 2.1.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 63 → 65 (+2.6)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 64 → 61 (-2.9)
- Architecture 79 → 89 (+9.8)
- Maturity 57 → 57 (+0.0)
- Readiness 86 → 86 (+0.0)
- Security 70 → 75 (+5.1)
- Accessibility 66 → 100 (+34.3)
Resolved (6)
- Critical CVE: [GHSA redacted] (Gemfile.lock)
- High CVE: [GHSA redacted] (Gemfile.lock)
- Medium CVE: [GHSA redacted] (Gemfile.lock)
- Medium vulnerability: [GHSA redacted] (Gemfile.lock)
- Off-boarding risk: anonymized user #1
- Projects may be oversized for their cohesion
New (11)
- Critical CVE: [GHSA redacted] (Gemfile.lock)
- Edited copy of a member (4 corresponding lines) (app/controllers/devise/registrations_controller.rb)
- High CVE: [GHSA redacted] (Gemfile.lock)
- High CVE: [GHSA redacted] (Gemfile.lock)
- High CVE: [GHSA redacted] (Gemfile.lock)
- Low CVE: [GHSA redacted] (Gemfile.lock)
- Medium CVE: [GHSA redacted] (Gemfile.lock)
- Medium CVE: [GHSA redacted] (Gemfile.lock)
- Medium CVE: [GHSA redacted] (Gemfile.lock)
- Medium CVE: [GHSA redacted] (Gemfile.lock)
- Off-boarding risk: anonymized user #1
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
heartcombo/devise was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 05811fb8366edd08874111d0f6fb44543e1c91ef — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-36d4cd83012f.