fix(android): drop AllowFileAccess + AllowUniversalAccessFromFileURLs on the BitBox bridge WebView#363
Open
jim-daf wants to merge 1 commit into
Open
Conversation
…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.
👷 Deploy request for app-swiss-bitcoin-pay-ch pending review.Visit the deploys page to approve it
|
👷 Deploy request for swissbitcoinpayapp pending review.Visit the deploys page to approve it
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #362.
BitBoxBridgeModule.startServer()configures the hiddensbp_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 afile://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.