In Android, JavaScript Interface Injection Vulnerability

大憨熊 提交于 2019-12-08 03:35:00

问题


My application received [Remediation for JavaScript Interface Injection Vulnerability] from Google PlayStore.

Webview control via javascript interface in non-https webpage.

This is my solution.

It is correct for this issue? or how to modify?

public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {

    if(request.getUrl().getHost().equals("mydomain.com")) {
        view.addJavascriptInterface(new MyJavaScriptInterface(), "myview");
    } else {
        view.removeJavascriptInterface("myview");
    }
    return super.shouldOverrideUrlLoading(view, request);
}

回答1:


I solved using https url. I installed on my site an ssl certificate.



来源:https://stackoverflow.com/questions/53631536/in-android-javascript-interface-injection-vulnerability

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!