I am working on an application which is largely written in Native and supporting Ice Cream Sandwich. However, I need to add some WebViews. There are lots of discussions on WebView security and when I use setJavaScriptEnabled(true), it gives me a warning:"Using setJavaScriptEnabled can introduce XSS vulnerabilities into you application, review carefully."
Just want to be very careful using WebView and setJavaScriptEnable(true). I have followed Android WebView Security Tips and suggestions. But there is no best practice check list.
What I have done so far:
- Only load trusted content to WebView. Either from local html or from our back end.
Intercept all requests from WebView by implementing
webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // magic return true; } });
- Make sure all back end requests are using https and only sent to our back end.
- Detect SSL warning.
- Checksum check local html/JavaScript files.
- Minify JavaScript files
- Update Security Provider to Protect Against SSL Exploits
There are also some other protections not specifically for WebView, such as encrypt messages and jail broken check, etc.
Is there anything else I am missing? How secure is my app?
Thanks