Skip to content

Commit

Permalink
root address instead of 404
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonwittwer committed Dec 8, 2022
1 parent 7a29a78 commit 7680031
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions app/controllers/shopify_app/callback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ def update_rails_cookie(api_session, cookie)

def redirect_to_app
if ShopifyAPI::Context.embedded?
return_to = session.delete(:return_to) || ""
return head(:not_found) if deduced_phishing_attack?

redirect_to(sanitized_host + return_to, allow_other_host: true)
return_to = "#{sanitized_host}#{session.delete(:return_to)}"
return_to = ShopifyApp.configuration.root_url if deduced_phishing_attack?
redirect_to(return_to, allow_other_host: true)
else
redirect_to(return_address)
end
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/callback_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class CallbackControllerTest < ActionController::TestCase
})

get :callback, params: hacker_params
assert_response 404
assert_redirected_to ShopifyApp.configuration.root_url
end

test "#callback sets the shopify_user_id in the Rails session when session is online" do
Expand Down

0 comments on commit 7680031

Please sign in to comment.