mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-17 04:34:24 +00:00
Per review, check the URL is from a stripe subdomain
This commit is contained in:
@@ -27,9 +27,9 @@ module Stripe
|
||||
next_action_type = next_action["type"]
|
||||
return unless %w(authorize_with_url redirect_to_url).include?(next_action_type)
|
||||
|
||||
url = next_action[next_action_type]["url"]
|
||||
host = URI(url).host
|
||||
url if url.match(%r{https?://\S+}) && host.match?(/\S?stripe.com\Z/)
|
||||
url = URI(next_action[next_action_type]["url"])
|
||||
# Check the URL is from a stripe subdomain
|
||||
url.to_s if url.is_a?(URI::HTTPS) && url.host.match?(/\.stripe.com\Z/)
|
||||
end
|
||||
|
||||
# This field is used because the Spree code recognizes and stores it
|
||||
|
||||
@@ -37,7 +37,7 @@ RSpec.describe Stripe::AuthorizeResponsePatcher do
|
||||
"status" => "requires_source_action",
|
||||
"next_source_action" => {
|
||||
"type" => "authorize_with_url",
|
||||
"authorize_with_url" => { "url" => "https://www.stripe.com.malicious.org/authorize" }
|
||||
"authorize_with_url" => { "url" => "https://www.evil-stripe.com.malicious.org/authorize" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user