Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Corrected Compliant Solution #1 explanatory text

...

Code Block
bgColor#FFCCCC
WebView webView = new WebView(this);
setContentView(webView);
...
class JsObject {

     private String @JavascriptInterfacesensitiveInformation;
     public String toString() { return "injectedObject"sensitiveInformation; }
 }
 webView.addJavascriptInterface(new JsObject(), "injectedObject");
 webView.loadData("", "text/html", null);
 webView.loadUrl("http://www.example.com");

...

Compliant Solution #1

Compliant code could not call refrain from calling the addJavascriptInterface() method, leaving the WebView in the default safe state of having JavaScript disabled.

Code Block
bgColor#CCCCFF
WebView webView = new WebView(this);
setContentView(webView);
...

...