A Java object is exposed to the scripts of a WebView
What it finds
webView.addJavascriptInterface(bridge, "app") lets every script of every page the view loads call the public methods of bridge, including scripts injected into untrusted content (CWE-749), as the Android documentation of the method warns.
Reported is a call of addJavascriptInterface.
From the rule's source, javascript_interface.rs.
import android.webkit.WebView; class Bridge { void setup(WebView view, Object api) { view.addJavascriptInterface(api, "app");tx0 reports: can call the methods of this object }} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/java: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/java:javascript-interface] reason="..."tx0 explain tx0/java:javascript-interface shows the same in the terminal. Found a false positive? Report it.