Project

General

Profile

Actions

Defect #41930

closed

Redirection after signing in fails when the back_url includes a port number

Added by Kenta Kumojima about 2 months ago. Updated 3 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Accounts / authentication
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

If URI contains a port, I cannot redirect to back_url after login.

If back_uri contains port, ApplicationController#validate_back_url raises Addressable::URI::InvalidURIError and returns false.
So, hidden field of back_url is not rendered at '/login'.
The validation method should remove the port before the host.

       [:scheme, :host, :port].each do |component|                                                                                                                                                       
         if uri.send(component).present? && uri.send(component) != request.send(component)
           return false
         end

         uri.send(:"#{component}=", nil) # => raises InvalidURIError
       end

Files

fix_redirect_to_back_url_with_port.patch (2.14 KB) fix_redirect_to_back_url_with_port.patch Kenta Kumojima, 2024-12-03 16:29
41930-v2.patch (2.09 KB) 41930-v2.patch Go MAEDA, 2025-01-28 02:44

Related issues

Related to Redmine - Defect #31831: Back url parse in validationClosedMarius BÄ‚LTEANU

Actions
Actions

Also available in: Atom PDF