A WebView is allowed to load plain HTTP content into HTTPS pages

tx0/kotlin:webview-mixed-contentdefaultwarningsecurity/cryptodepth fastsecurity, android, cwe-319

What it finds

MIXED_CONTENT_ALWAYS_ALLOW lets a secure page load scripts and other content over plain HTTP, which an attacker on the network can replace. Android blocks mixed content by default since API 21.

From the rule's source, webview_mixed_content.rs.

Example from the rule's tests
fun setup(view: WebView) {    view.settings.mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOWtx0 reports: the web view loads plain HTTP content    view.settings.mixedContentMode = WebSettings.MIXED_CONTENT_NEVER_ALLOW}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/kotlin:webview-mixed-content" = "off"

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-mixed-content] reason="..."

tx0 explain tx0/kotlin:webview-mixed-content shows the same in the terminal. Found a false positive? Report it.