Repository navigation
Conversation
sanitize_shop_domain appends the myshopify domain to a dotless host, so a host like 134744072 passed the phishing check, while the redirect used it as is and browsers read it as the IPv4 address 8.8.8.8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CeDMXvnXpfdUM29YZ4nQeq
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CeDMXvnXpfdUM29YZ4nQeq
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CeDMXvnXpfdUM29YZ4nQeq
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CeDMXvnXpfdUM29YZ4nQeq
Author
|
I have signed the CLA! |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CeDMXvnXpfdUM29YZ4nQeq
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Follow-up to #2078.
safe_embedded_app_urlstill lets a dotless host through:deduced_phishing_attack?validates withShopifyApp::Utils.sanitize_shop_domain, which appends the myshopify domain when the value has no dot, so134744072passes as134744072.myshopify.com.https://134744072/apps/<api_key>.134744072(and0x08080808) as the IPv4 address8.8.8.8, and decodeevil%2ecomorevil。com(ideographic full stop) toevil.com. So the generated home controller redirects to an arbitrary IP or domain from the app's domain.unsafe_embedded_host?now also rejects a host whose authority has no dot. Real hosts (admin.shopify.com/store/<shop>,<shop>.myshopify.com/admin, spin/dev domains) always have one.Reviewer's guide to testing
test/controllers/concerns/embedded_app_test.rb: the two new tests (numeric host, percent-encoded dot) fail on main (redirects tohttps://134744072/...andhttps://evil%2ecom/...) and pass with the fix. Full suite green.https://8.8.8.8/...; with this branch it goes to the root URL, andadmin.shopify.com/store/<shop>still redirects into the admin.host=base64("evil%2ecom")redirects tohttps://evil%2ecom/apps/..., which Chrome opens ashttps://evil.com/apps/...; with this branch it goes to the root URL.Things to focus on
lib/shopify_app/controller_concerns/embedded_app.rb: the dotless check sits next to the userinfo check from Improve host validation #2078.Checklist
CHANGELOG.mdif the changes would impact usersREADME.md, if appropriate./docs, if necessary