Skip to content

Reject dotless embedded app hosts - #2089

Open
dostu wants to merge 5 commits into
Shopify:mainfrom
dostu:reject-dotless-embedded-host
Open

dostu wants to merge 5 commits into
Shopify:mainfrom
dostu:reject-dotless-embedded-host

Conversation

@dostu

@dostu dostu commented Oct 8, 2026 •

Copy link
Copy Markdown

What this PR does

Follow-up to #2078. safe_embedded_app_url still lets a dotless host through:

  • deduced_phishing_attack? validates with ShopifyApp::Utils.sanitize_shop_domain, which appends the myshopify domain when the value has no dot, so 134744072 passes as 134744072.myshopify.com.
  • The redirect is built from the original value: https://134744072/apps/<api_key>.
  • Browsers read 134744072 (and 0x08080808) as the IPv4 address 8.8.8.8, and decode evil%2ecom or evil。com (ideographic full stop) to evil.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 to https://134744072/... and https://evil%2ecom/...) and pass with the fix. Full suite green.
  • Checked in Chrome against an app on 23.0.3 using the generated home controller: before, the redirect opened https://8.8.8.8/...; with this branch it goes to the root URL, and admin.shopify.com/store/<shop> still redirects into the admin.
  • On main host=base64("evil%2ecom") redirects to https://evil%2ecom/apps/..., which Chrome opens as https://evil.com/apps/...; with this branch it goes to the root URL.

Things to focus on

  1. lib/shopify_app/controller_concerns/embedded_app.rb: the dotless check sits next to the userinfo check from Improve host validation #2078.

Checklist

  • Update CHANGELOG.md if the changes would impact users
  • Update README.md, if appropriate.
  • Update any relevant pages in /docs, if necessary
  • For security fixes, the Disclosure Policy must be followed. Open redirects without further impact are ineligible in the HackerOne program, so this is filed as a hardening PR, like Improve host validation #2078.

dostu and others added 2 commits October 8, 2026 16:12
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
@github-actions github-actions Bot added cla-needed devtools-gardener Post the issue or PR to Slack for the gardener labels Oct 8, 2026
dostu and others added 2 commits October 8, 2026 16:15
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
@dostu

dostu commented Oct 8, 2026

Copy link
Copy Markdown
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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devtools-gardener Post the issue or PR to Slack for the gardener

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant