مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-05-31 04:35:42 +00:00
refactor(auth): tighten return_to validation
url_with_return_to only checked that return_to started with a forward slash, which also allowed protocol-relative values like //host and /\host. Rails 7.1 already refuses to follow those via redirect_to, so the user just saw a 500. Reject the same shapes in the helper instead so we fall back to the default URL cleanly. Adds a sessions request spec covering the rejected shapes plus the happy-path relative redirect.
هذا الالتزام موجود في:
@@ -62,10 +62,13 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def url_with_return_to(url)
|
||||
if params[:return_to].blank? || !params[:return_to].starts_with?("/")
|
||||
return_to = params[:return_to]
|
||||
if return_to.blank? ||
|
||||
!return_to.start_with?("/") ||
|
||||
return_to.start_with?("//", "/\\")
|
||||
url_for(url)
|
||||
else
|
||||
params[:return_to]
|
||||
return_to
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم