Skip to content

fix(android): drop AllowFileAccess + AllowUniversalAccessFromFileURLs on the BitBox bridge WebView#363

Open
jim-daf wants to merge 1 commit into
SwissBitcoinPay:mainfrom
jim-daf:fix-bitbox-webview-fileurls
Open

fix(android): drop AllowFileAccess + AllowUniversalAccessFromFileURLs on the BitBox bridge WebView#363
jim-daf wants to merge 1 commit into
SwissBitcoinPay:mainfrom
jim-daf:fix-bitbox-webview-fileurls

Conversation

@jim-daf
Copy link
Copy Markdown

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

Closes #362.

BitBoxBridgeModule.startServer() configures the hidden sbp_bitbox_webview:

vw.getSettings().setJavaScriptEnabled(true);
vw.getSettings().setAllowUniversalAccessFromFileURLs(true);
vw.getSettings().setAllowFileAccess(true);

The WebView is created from the React Native side as <Webview androidWebviewId=\"sbp_bitbox_webview\" source={{ html: \"\" }} ... />, so it is never on a file:// origin. Both file-access flags only take effect once the WebView lands on a file scheme, so they do not change anything for the BitBox JS bridge handshake but they expand what a file URL page could read if the WebView ever ended up on one.

setAllowUniversalAccessFromFileURLs(true) in particular is the CWE-200 pattern called out in Android's WebSettings documentation: it lets a file URL page issue XHR against any other origin, including app-private files served by the WebView's data dir.

Change

Delete the two setAllow... calls. Defaults are correct for what this WebView does. On API 30+ both default to false anyway; on older devices they default to true unless turned off explicitly, so the removal tightens posture on those devices while leaving modern behaviour unchanged.

setJavaScriptEnabled(true) and the bridge stay in place, since those are how the BitBox handshake actually works.

…Ls on BitBox webview

The hidden WebView used to host the BitBox JS bridge is created with
source={{ html: "" }} and never navigates to a file:// URL. Setting
AllowUniversalAccessFromFileURLs(true) and AllowFileAccess(true) only
matters once the WebView lands on a file scheme, so neither flag does
anything useful for the BitBox handshake.

Both stay disabled by default on API 30+ but are still true on older
devices unless toggled, so we drop the toggle to keep posture tight on
those devices while behaviour on modern Android is unchanged.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

👷 Deploy request for app-swiss-bitcoin-pay-ch pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 0f2f34f

@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

👷 Deploy request for swissbitcoinpayapp pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 0f2f34f

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.

Android BitBox bridge sets AllowUniversalAccessFromFileURLs / AllowFileAccess on a hidden WebView that never loads a file URL

1 participant