Update dependency devise to v5.0.4 [SECURITY]#344
Open
renovate[bot] wants to merge 1 commit intomainfrom
Open
Conversation
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.
This PR contains the following updates:
5.0.3→5.0.4Devise has an Open Redirect via Unvalidated
request.referrerin Timeoutable Session Timeout HandlerCVE-2026-40295 / GHSA-jp94-3292-c3xv
More information
Details
Summary
When the
Timeoutablemodule is enabled in Devise, theFailureApp#redirect_urlmethod returnsrequest.referrer— the HTTPRefererheader, which is attacker-controllable — without validation for any non-GET request that results in a session timeout. An attacker who hosts a page with an auto-submitting cross-origin form can cause a victim with an expired Devise session to be redirected to an arbitrary external URL. This contrasts with the GET timeout path (which uses server-sideattempted_path) and Devise's ownstore_location_formechanism (which strips external hosts viaextract_path_from_location), both of which are protected; only the non-GET timeout redirect path is unprotected.Details
The vulnerable code is in
lib/devise/failure_app.rb:This is passed directly to
redirect_to:The GET timeout path uses
attempted_path, which is set server-side by Warden and cannot be influenced by the client. Thestore_location!method also only runs for GET requests, so no session-based protection is applied on POST timeouts.By contrast, Devise's
store_location_formethod (used elsewhere) correctly sanitizes URLs viaextract_path_from_location, which strips the scheme and host.Impact
Note: Rails' built-in open-redirect protection does not mitigate this issue.
Devise::FailureAppis anActionController::Metalapp with its own isolated copy of the relevant redirect configuration, soconfig.action_controller.action_on_open_redirect = :raise(and the olderraise_on_open_redirectssetting) do not reach it.Patches
This is patched in Devise v5.0.4. Users should upgrade as soon as possible.
Workaround
None beyond upgrading. If an upgrade is not immediately possible, the same changes from the patch commit can be applied as a monkey-patch in a Rails initializer (
Devise::FailureApp#redirect_urlandDevise::Controllers::StoreLocation#extract_path_from_location). Remove the monkey-patch after upgrading.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
heartcombo/devise (devise)
v5.0.4Compare Source
FailureAppvia unvalidatedRefererheader on non-GET session timeout. CVE-2026-40295 GHSA-jp94-3292-c3xvConfiguration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.