In Google Play Store am getting warning below like this,
Your app contains one or more libraries with known security issues. Please see this Google Help Center article for details.
Vulnerable JavaScript libraries:
Note: when loading webview in my app i will InterceptRequest in webview url and load the local jquery_min.js file from raw folder resource which helps us to load the webpage faster due this function and i save 5 gb download from server per month.
Sample WebView Program
LoadLocalScripts localScripts=new LoadLocalScripts(this);
webView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return true;
}
//Show loader on url load
public void onLoadResource(WebView view, String url) {
}
public void onPageFinished(WebView view, String url) {
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
}
@Override
public WebResourceResponse shouldInterceptRequest (final WebView view, String url) {
WebResourceResponse response= localScripts.getLocalSCripts(url);
if(response==null) {
return super.shouldInterceptRequest(view, url);
}else{
return response;
}
}
});
webView.loadUrl(url);
Class for Loading local scripts
public class LoadLocalScripts {
private Context ctx;
public LoadLocalScripts(Context context) {
ctx=context;
}
public WebResourceResponse getLocalSCripts(String url)
{
//Log.e("url_raw",url);
if (url.contains(".css")) {
if(url.contains("bootstrap.min.css")) {
return getCssWebResourceResponseFromRawResource("bootstrap_min.css");
}else {
return null;
}
}else if (url.contains(".js")){
if(url.contains("bootstrap.min.js")) {
return getScriptWebResourceResponseFromRawResource("bootstrap_min.js");
} else if(url.contains("jquery.lazyload.min.js")) {
return getScriptWebResourceResponseFromRawResource("lazyload_min.js");
} else{
return null;
}
} else {
return null;
}
}
/**
* Return WebResourceResponse with CSS markup from a raw resource (e.g. "raw/style.css").
*/
private WebResourceResponse getCssWebResourceResponseFromRawResource(String url) {
//Log.e("url_raw",url);
if(url.equalsIgnoreCase("bootstrap_min.css")) {
return getUtf8EncodedCssWebResourceResponse(ctx.getResources().openRawResource(R.raw.bootstrap_min));
}else {
return null;
}
}
private WebResourceResponse getScriptWebResourceResponseFromRawResource(String url) {
//Log.e("url_raw",url);
if(url.equalsIgnoreCase("bootstrap_min.js")) {
return getUtf8EncodedScriptWebResourceResponse(ctx.getResources().openRawResource(R.raw.bootstrap_min_js));
}else if(url.equalsIgnoreCase("lazyload_min.js")) {
return getUtf8EncodedScriptWebResourceResponse(ctx.getResources().openRawResource(R.raw.lazyload_min));
}else {
return null;
}
}
private WebResourceResponse getUtf8EncodedCssWebResourceResponse(InputStream data) {
return new WebResourceResponse("text/css", "UTF-8", data);
}
private WebResourceResponse getUtf8EncodedScriptWebResourceResponse(InputStream data) {
return new WebResourceResponse("text/javascript", "UTF-8", data);
}
}
This issue refers to an old vulnerability of jquery from your res/raw/jquery_min.js file.
Just updated the jquery_min.js to v3.4.1 and fix it.
You can fix it manually in your file change in the code:
From:
if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||
To:
if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(k.isPlainObject(r)||
I found this solution in https://www.privacy-wise.com/mitigating-cve-2019-11358-in-old-versions-of-jquery/ and worked for me.