Skip to content

fix(error-pages): use a stable baseUrl instead of null in loadDataWithBaseURL#329

Open
jim-daf wants to merge 1 commit into
CookieJarApps:masterfrom
jim-daf:fix-error-page-baseurl
Open

fix(error-pages): use a stable baseUrl instead of null in loadDataWithBaseURL#329
jim-daf wants to merge 1 commit into
CookieJarApps:masterfrom
jim-daf:fix-error-page-baseurl

Conversation

@jim-daf
Copy link
Copy Markdown

@jim-daf jim-daf commented May 15, 2026

Closes #328.

SmartCookieKT.kt builds five error interstitial pages (HTTPS-not-supported, onReceivedError, malware warning, site-blocked-by-list x2) and passes null as the baseUrl to loadDataWithBaseURL, with JavaScript turned on for the inline reload() helper. null makes the page run with about:blank as its effective origin.

Today every interpolated value (title, error, reload) comes from string resources or fixed error codes, so there is no known XSS sink here. The change is defense in depth: if anyone later inlines a network-error string, a previous-page title, or a piece of the failing URL into the same template, a stable baseUrl keeps the page out of the `about:blank` origin and avoids a same-origin escape on top of the WebView.

Change

Swap null for "https://smartcookieweb-error.local" (a host that never resolves but gives the WebView a stable origin) in all five loadDataWithBaseURL calls in the file. Rendered output is unchanged.

…hBaseURL

The error / HTTPS-failure / site-blocked / malware-warning pages in
SmartCookieKT were fed to the WebView with null as the baseUrl. With
JavaScript enabled (the inline <script> defines reload()), a null
baseUrl makes the page run with about:blank as its effective origin,
which means any future change that inlines untrusted content
(network error text from another stack, page title from the
previous URL, etc.) into the same template would XSS the WebView
unrestricted.

Today all three interpolated values come from string resources or
fixed error codes, so this is defense-in-depth rather than a fix
for a known exploit, but the swap to a stable https://...local
baseUrl is one line per call site.
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.

Error / blocked-site WebView pages use null as baseUrl with JavaScript on

1 participant