Skip to content

Commit

Permalink
fix: pass stirng to redirect_to funciton
Browse files Browse the repository at this point in the history
  • Loading branch information
leuke-naam committed Dec 26, 2024
1 parent b697f7b commit ec9f767
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/members/payments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def pay_activities
transaction_type: :activity,
redirect_uri: member_payments_path
)

if payment.save
# Check URI for safety (supresses brakeman warning)
url = begin
Expand All @@ -55,7 +56,7 @@ def pay_activities

# Check if it's a valid URI and matches your whitelist of acceptable domains (e.g., only http(s)://example.com)
if url.is_a?(URI::HTTP) && ['mollie.com'].include?(url.host)
redirect_to(url)
redirect_to(url.to_s)
else
# Fallback to a safe default redirect if the URI is invalid or not in the whitelist
redirect_to(root_path)
Expand Down

0 comments on commit ec9f767

Please sign in to comment.