A WebView is allowed to read local files, or to let pages read them
What it finds
allowFileAccess, allowFileAccessFromFileURLs and allowUniversalAccessFromFileURLs set to true let content in the view read files of the app, and the last two let a loaded file read other files or any origin, which a malicious page or file uses to steal data.
From the rule's source, webview_file_access.rs.
fun setup(view: WebView) { view.settings.allowFileAccess = truetx0 reports: allowFileAccess lets web content read local files view.settings.setAllowUniversalAccessFromFileURLs(true)tx0 reports: allowUniversalAccessFromFileURLs lets view.settings.allowFileAccess = false} 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/kotlin:webview-file-access" = "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-file-access] reason="..."tx0 explain tx0/kotlin:webview-file-access shows the same in the terminal. Found a false positive? Report it.