An object is exposed to the scripts of a WebView
What it finds
webView.addJavascriptInterface(bridge, "app") lets every script in the view call the methods of bridge marked @JavascriptInterface. If the view ever shows content the app does not control, that content calls into the app. Review what the bridge allows and where the view loads from.
From the rule's source, javascript_interface.rs.
fun setup(view: WebView, bridge: Bridge) { view.addJavascriptInterface(bridge, "app")tx0 reports: an object is exposed to every script} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/kotlin:webview-javascript-interface" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/kotlin:webview-javascript-interface] reason="..."tx0 explain tx0/kotlin:webview-javascript-interface shows the same in the terminal. Found a false positive? Report it.