Skip to content

fix(android): block initial URL load in sandbox mode#16

Merged
janicduplessis merged 1 commit intorainbow-customizations-part1from
fix/android-sandbox-initial-load
Apr 15, 2026
Merged

fix(android): block initial URL load in sandbox mode#16
janicduplessis merged 1 commit intorainbow-customizations-part1from
fix/android-sandbox-initial-load

Conversation

@janicduplessis
Copy link
Copy Markdown
Collaborator

@janicduplessis janicduplessis commented Apr 13, 2026

Summary

Stacked on #14.

Fixes a bug where sandboxed WebViews could load blocked domains as their initial page. Tested this with the new sandbox e2e test here.

Problem

shouldOverrideUrlLoading doesn't fire for the initial source URL on Android. This means when a WebView is in sandbox mode, the very first page load bypasses the host allowlist check entirely, allowing blocked domains to render.

Fix

  • Added a host allowlist check in onPageStarted — if the domain isn't in the allowed list, stopLoading() is called immediately
  • Emits onReceivedError so the JS onError callback fires, letting the app handle the blocked navigation
  • Also added the missing onReceivedError call in the existing shouldOverrideUrlLoading block so both code paths now consistently report errors back to JS

shouldOverrideUrlLoading doesn't fire for the initial source URL, so
sandboxed WebViews could load blocked domains as their first page.

Added host allowlist check in onPageStarted — if the domain isn't
allowed, stops loading and emits onReceivedError so the JS onError
callback fires.
@janicduplessis janicduplessis merged commit 889378e into rainbow-customizations-part1 Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants