• <bdo id='08hCc'></bdo><ul id='08hCc'></ul>
    <i id='08hCc'><tr id='08hCc'><dt id='08hCc'><q id='08hCc'><span id='08hCc'><b id='08hCc'><form id='08hCc'><ins id='08hCc'></ins><ul id='08hCc'></ul><sub id='08hCc'></sub></form><legend id='08hCc'></legend><bdo id='08hCc'><pre id='08hCc'><center id='08hCc'></center></pre></bdo></b><th id='08hCc'></th></span></q></dt></tr></i><div id='08hCc'><tfoot id='08hCc'></tfoot><dl id='08hCc'><fieldset id='08hCc'></fieldset></dl></div>
  • <tfoot id='08hCc'></tfoot><legend id='08hCc'><style id='08hCc'><dir id='08hCc'><q id='08hCc'></q></dir></style></legend>

        <small id='08hCc'></small><noframes id='08hCc'>

        Webview 在执行 onReceivedSslError 时避免来自 google play 的安全警报

        时间:2023-11-09
              <bdo id='Fv2ZJ'></bdo><ul id='Fv2ZJ'></ul>

              <i id='Fv2ZJ'><tr id='Fv2ZJ'><dt id='Fv2ZJ'><q id='Fv2ZJ'><span id='Fv2ZJ'><b id='Fv2ZJ'><form id='Fv2ZJ'><ins id='Fv2ZJ'></ins><ul id='Fv2ZJ'></ul><sub id='Fv2ZJ'></sub></form><legend id='Fv2ZJ'></legend><bdo id='Fv2ZJ'><pre id='Fv2ZJ'><center id='Fv2ZJ'></center></pre></bdo></b><th id='Fv2ZJ'></th></span></q></dt></tr></i><div id='Fv2ZJ'><tfoot id='Fv2ZJ'></tfoot><dl id='Fv2ZJ'><fieldset id='Fv2ZJ'></fieldset></dl></div>

              <small id='Fv2ZJ'></small><noframes id='Fv2ZJ'>

                <tbody id='Fv2ZJ'></tbody>
              <tfoot id='Fv2ZJ'></tfoot>

                  <legend id='Fv2ZJ'><style id='Fv2ZJ'><dir id='Fv2ZJ'><q id='Fv2ZJ'></q></dir></style></legend>
                  本文介绍了Webview 在执行 onReceivedSslError 时避免来自 google play 的安全警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个将在 webview 中打开的链接.问题是它无法打开,直到我像这样覆盖 onReceivedSslError:

                  I have a link which will open in webview. The problem is it cannot be open until I override onReceivedSslError like this:

                   @Override
                          public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
                              handler.proceed();
                          }
                  

                  我收到来自 google play 的安全警报:

                  I am getting security alert from google play saying:

                  安全警报您的应用程序的 WebViewClient.onReceivedSslError 处理程序的实现不安全.具体来说,该实现会忽略所有 SSL 证书验证错误,从而使您的应用容易受到中间人攻击.攻击者可以更改受影响的 WebView 的内容,读取传输的数据(例如登录凭据),并使用 JavaScript 在应用程序内执行代码.

                  Security alert Your application has an unsafe implementation of the WebViewClient.onReceivedSslError handler. Specifically, the implementation ignores all SSL certificate validation errors, making your app vulnerable to man-in-the-middle attacks. An attacker could change the affected WebView's content, read transmitted data (such as login credentials), and execute code inside the app using JavaScript.

                  要正确处理 SSL 证书验证,请更改代码以在服务器提供的证书符合您的期望时调用 SslErrorHandler.proceed(),否则调用 SslErrorHandler.cancel().包含受影响应用和类的电子邮件警报已发送至您的开发者帐户地址.

                  To properly handle SSL certificate validation, change your code to invoke SslErrorHandler.proceed() whenever the certificate presented by the server meets your expectations, and invoke SslErrorHandler.cancel() otherwise. An email alert containing the affected app(s) and class(es) has been sent to your developer account address.

                  请尽快解决此漏洞,并增加升级后的 APK 版本号.有关 SSL 错误处理程序的更多信息,请参阅开发者帮助中心中的文档.对于其他技术问题,您可以发布到 https://www.stackoverflow.com/questions 并使用标签android-security"和SslErrorHandler".如果您使用的是负责此问题的第 3 方库,请通知第 3 方并与他们一起解决问题.

                  Please address this vulnerability as soon as possible and increment the version number of the upgraded APK. For more information about the SSL error handler, please see our documentation in the Developer Help Center. For other technical questions, you can post to https://www.stackoverflow.com/questions and use the tags "android-security" and "SslErrorHandler." If you are using a 3rd party library that’s responsible for this, please notify the 3rd party and work with them to address the issue.

                  要确认您已正确升级,请将更新后的版本上传到开发者控制台,并在五个小时后回来查看.如果应用程序未正确升级,我们将显示警告.

                  To confirm that you've upgraded correctly, upload the updated version to the Developer Console and check back after five hours. If the app hasn't been correctly upgraded, we will display a warning.

                  请注意,虽然这些特定问题可能不会影响使用 WebView SSL 的每个应用,但最好及时更新所有安全补丁.存在使用户面临入侵风险的漏洞的应用可能会被视为违反内容政策和开发者分发协议第 4.4 节的危险产品.

                  Please note, while these specific issues may not affect every app that uses WebView SSL, it's best to stay up to date on all security patches. Apps with vulnerabilities that expose users to risk of compromise may be considered dangerous products in violation of the Content Policy and section 4.4 of the Developer Distribution Agreement.

                  请确保所有发布的应用都符合开发者分发协议和内容政策.如果您有任何问题或疑虑,请通过 Google Play 开发者帮助中心联系我们的支持团队.

                  Please ensure all apps published are compliant with the Developer Distribution Agreement and Content Policy. If you have questions or concerns, please contact our support team through the Google Play Developer Help Center.

                  如果我删除 onReceivedSslError (handler.proceed()),页面将无法打开.

                  If I remove onReceivedSslError (handler.proceed()), then page won't open.

                  无论如何我可以在 webview 中打开页面并避免安全警报.

                  推荐答案

                  要正确处理 SSL 证书验证,请将您的代码更改为每当提供的证书时调用 SslErrorHandler.proceed()服务器满足您的期望,并调用SslErrorHandler.cancel() 否则.

                  To properly handle SSL certificate validation, change your code to invoke SslErrorHandler.proceed() whenever the certificate presented by the server meets your expectations, and invoke SslErrorHandler.cancel() otherwise.

                  正如电子邮件所说,onReceivedSslError 应该处理用户访问证书无效的页面,例如通知对话框.您不应该直接进行.

                  As email said, onReceivedSslError should handle user is going to a page with invalid cert, such like a notify dialog. You should not proceed it directly.

                  例如,我添加了一个警告对话框以使用户确认并且似乎 Google 不再显示警告.

                  For example, I add an alert dialog to make user have confirmed and seems Google no longer shows warning.

                  @Override
                  public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
                      final AlertDialog.Builder builder = new AlertDialog.Builder(this);
                      builder.setMessage(R.string.notification_error_ssl_cert_invalid);
                      builder.setPositiveButton("continue", new DialogInterface.OnClickListener() {
                          @Override
                          public void onClick(DialogInterface dialog, int which) {
                              handler.proceed();
                          }
                      });
                      builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                          @Override
                          public void onClick(DialogInterface dialog, int which) {
                              handler.cancel();
                          }
                      });
                      final AlertDialog dialog = builder.create();
                      dialog.show();
                  }
                  

                  <小时>

                  更多解释电子邮件.


                  More explain about the email.

                  具体来说,实现会忽略所有 SSL 证书验证错误,使您的应用容易受到中间人攻击.

                  Specifically, the implementation ignores all SSL certificate validation errors, making your app vulnerable to man-in-the-middle attacks.

                  电子邮件称默认工具忽略了一个重要的 SSL 安全问题.所以我们需要在我们自己的使用 WebView 的应用程序中处理它.使用警告对话框通知用户是一种简单的方法.

                  The email says the default implement ignored an important SSL security problem. So we need to handle it in our own app which used WebView. Notify user with a alert dialog is a simple way.

                  这篇关于Webview 在执行 onReceivedSslError 时避免来自 google play 的安全警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:0 台设备支持 Android 应用 下一篇:如何在使用不同的 Intent 启动 Activity 时防止其出现多个实例

                  相关文章

                        <bdo id='omb2y'></bdo><ul id='omb2y'></ul>
                    1. <small id='omb2y'></small><noframes id='omb2y'>

                      <legend id='omb2y'><style id='omb2y'><dir id='omb2y'><q id='omb2y'></q></dir></style></legend>

                      <tfoot id='omb2y'></tfoot>
                    2. <i id='omb2y'><tr id='omb2y'><dt id='omb2y'><q id='omb2y'><span id='omb2y'><b id='omb2y'><form id='omb2y'><ins id='omb2y'></ins><ul id='omb2y'></ul><sub id='omb2y'></sub></form><legend id='omb2y'></legend><bdo id='omb2y'><pre id='omb2y'><center id='omb2y'></center></pre></bdo></b><th id='omb2y'></th></span></q></dt></tr></i><div id='omb2y'><tfoot id='omb2y'></tfoot><dl id='omb2y'><fieldset id='omb2y'></fieldset></dl></div>