Skip to content

Drop allowFileAccessFromFileURLs and allowUniversalAccessFromFileURLs in VectorWebViewActivity and WidgetWebView#9145

Open
jim-daf wants to merge 1 commit into
element-hq:developfrom
jim-daf:fix-webview-file-url-flags-upstream
Open

Drop allowFileAccessFromFileURLs and allowUniversalAccessFromFileURLs in VectorWebViewActivity and WidgetWebView#9145
jim-daf wants to merge 1 commit into
element-hq:developfrom
jim-daf:fix-webview-file-url-flags-upstream

Conversation

@jim-daf
Copy link
Copy Markdown

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

Type: Bug fix
Issue: #9144

Motivation

Two WebView setup paths still toggle the deprecated allowFileAccessFromFileURLs and allowUniversalAccessFromFileURLs flags even though neither WebView ever loads a file:// main frame.

VectorWebViewActivity

Invoked through VectorWebViewActivity.getIntent(context, url, ...). Every call site that builds that intent supplies an http or https URL (identity-server terms pages, SSO fallback, etc.). The two flags only take effect on a file:// main frame, so they do nothing for the actual launch paths.

WidgetWebView

Widgets are served from the integration server's https widget URL. Same reasoning applies.

Content

Drop the setAllowFileAccessFromFileURLs = true and setAllowUniversalAccessFromFileURLs = true lines in both files. Replace them with a short inline comment recording why neither flag is needed.

allowUniversalAccessFromFileURLs = true is the universal-XSS flag from the WebSettings javadoc (lets a file:// page XHR any origin, CWE-200). It is unsafe to leave on as a safety margin if a future code path ever loads a file:// document into one of these WebViews. The @Suppress("DEPRECATION") annotations on the removed lines suggest the deprecation warning was acknowledged but the flags were never re-evaluated.

On pre-API-30 devices both flags default to true, so removing the explicit = true lines is a tightening on those devices rather than a no-op only on API 30+.

Provenance

Originally filed against the SchildiChat fork (SchildiChat/SchildiChat-android#284, #285). The maintainer asked me to file it upstream, so this PR is the upstream version.

Test plan

The change is two lines removed in each file plus a short comment. No other WebView setting touched. Both call paths continue to load their http/https URLs unchanged.

Checklist

  • Changelog file added (changelog.d/9144.bugfix)

… in the two simple WebViews

VectorWebViewActivity (the 'simple' WebView used to open identity
server terms pages, SSO fallback URLs and similar links) and
WidgetWebView (the WebView that hosts Matrix widget integrations)
both turn on:

    allowFileAccessFromFileURLs       = true   // @Suppress(DEPRECATION)
    allowUniversalAccessFromFileURLs  = true   // @Suppress(DEPRECATION)

Both flags only take effect when the main frame is itself a file://
URL. VectorWebViewActivity is invoked via getIntent(context, url, ...)
and every call site that builds that intent supplies an http or https
URL. WidgetWebView is pointed at the widget's https URL. No call site
loads a file:// document into either WebView, so neither flag is
load-bearing for any existing path.

allowUniversalAccessFromFileURLs in particular lets a file:// page
XHR any origin, the classic CWE-200 sandbox escape, and is the reason
the AOSP API was deprecated. The @Suppress comments suggest the
deprecation warning was acknowledged but the flags themselves were
not re-evaluated.

Drop both lines in both files. Behaviour for the existing https
widget and link flows is unchanged. On pre-API-30 devices (where the
WebView defaults to true for both flags) this is a tightening rather
than a no-op.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 13, 2026

CLA assistant check
All committers have signed the CLA.

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