book-reader/app
Dimitris Dafnis c0d0e57e79
fix(webview): gate setWebContentsDebuggingEnabled on BuildConfig.DEBUG and drop unused allowFileAccess in MathMLRenderer (#303)
Three WebView setup paths exist in the app. MyApplication.kt already wraps
setWebContentsDebuggingEnabled in 'if (BuildConfig.DEBUG)'. The other two
paths were missing the guard:

  - MainActivity.onCreate calls WebView.setWebContentsDebuggingEnabled(true)
    unconditionally at the end of onCreate. On a release build that leaves
    chrome://inspect attachable from any USB-connected machine for any
    WebView the app spawns later. CWE-489.

  - MathMLRenderer.setupWebView does the same thing before constructing
    the renderer WebView. Same exposure.

While in MathMLRenderer, drop settings.allowFileAccess = true. The
renderer only ever loads file:///android_asset/MathML-template.html, and
the android_asset scheme is permitted on every supported Android version
even when setAllowFileAccess(false) is in force. The flag is dead and
the WebView is set up with javaScriptEnabled = true + a JS bridge, so
leaving it on widens the surface for no benefit.

ChapterWebView intentionally keeps allowFileAccess = true because the
custom-font path renders @font-face src: url('file://<path>') against
the user-picked font file.
2026-05-14 12:26:38 +05:30
..
src fix(webview): gate setWebContentsDebuggingEnabled on BuildConfig.DEBUG and drop unused allowFileAccess in MathMLRenderer (#303) 2026-05-14 12:26:38 +05:30
.gitignore Initial commit 2026-02-24 17:37:40 +05:30
build.gradle.kts Windows (#291) 2026-05-10 10:07:37 +05:30
proguard-rules.pro V1.0.46 oss (#253) 2026-04-29 16:37:53 +05:30