fix(register): allow all WebView frame schemes so the Turnstile challenge completes on iOS#3287
Conversation
…enge completes on iOS #3284 widened the Turnstile WebView's originWhitelist to ['https://*', 'about:'] and added an onShouldStartLoadWithRequest that returned true only for https/about. But react-native- webview gates every frame against originWhitelist, and Cloudflare's Managed challenge also spins up blob:/data: compute sub-frames. Those were cancelled, so the challenge never issued a token and the widget stayed blank with a dead "Register Free". about: was necessary but not sufficient on its own. This WebView only ever loads our own embed page plus the CF challenge it pulls in, so allow all schemes (originWhitelist ['*']) and drop the custom handler instead of enumerating the schemes Cloudflare uses. Add dev-only webviewDebuggingEnabled for on-device Safari Web Inspector diagnosis.
|
Warning Review limit reached
More reviews will be available in 16 minutes and 11 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Address Greptile review: originWhitelist ['*'] with no handler left top-level navigation unguarded, so a compromised embed page or open redirect could steer the WebView to file:/javascript:/another origin. Restore onShouldStartLoadWithRequest but gate ONLY the top-level document to our own origin; every sub-frame is still allowed, so Cloudflare's about:/blob:/data: compute frames are never re-blocked (a sub-frame is never the top frame).
Problem
On iOS the free-signup Turnstile widget renders blank and "Register Free" stays disabled (the challenge never issues a token). Reproduced on the latest TestFlight build from
development, which already includes #3284.Root cause
react-native-webview gates every frame navigation against
originWhitelist(WebViewShared.js→compileWhitelist/passesWhitelist). #3284 set the list to['https://*', 'about:']and added anonShouldStartLoadWithRequestthat returnedtrueonly forhttps/about.Cloudflare's Managed challenge renders in a
challenges.cloudflare.comiframe and runs its verification compute in nested sub-frames across several schemes —about:srcdoc/about:blankand, on iOS, oftenblob:/data:. The narrow whitelist plus the restrictive handler cancelled theblob:/data:compute frames, so the challenge could never complete. #3284 unblockedabout:(which is why the symptom moved from "spins on Verifying…" to fully blank) but that alone was not sufficient.The embed page itself is healthy on prod (returns the correct widget HTML, the enforced CSP permits the CF script, and Cloudflare is not challenging it) — the failure is entirely in the iOS WebView's per-scheme frame gating.
Fix
This WebView only ever loads our own first-party
/embed/turnstilepage plus the Cloudflare challenge it pulls in, so there is no value in enumerating which schemes Cloudflare uses:originWhitelist={['*']}so no scheme the challenge needs (about:,blob:,data:) is dropped. This is a superset of the previous list —about:is still allowed.onShouldStartLoadWithRequest(with['*']a handler could only re-add the same restriction).webviewDebuggingEnabled={__DEV__}so any remaining issue can be inspected on-device via Safari Web Inspector on a dev build, without shipping an inspectable WebView to release/TestFlight.Testing
yarn ios) on a real device, open free signup, and confirm the Turnstile widget renders and "Register Free" enables after the check. If anything is still off, attach Safari Web Inspector (now enabled in dev) and capture the failing frame/console.