android - 来自 Google Play 商店的 Android React Native App HostNameVerifier 错误
问题描述
请帮忙,我在 MainApplication.java 文件中有以下实现。我正在检查固定的主机名,然后相应地返回 true 或 false。
错误不安全的主机名验证程序
安全性 您的应用正在使用不安全的主机名验证器实现。请参阅此 Google 帮助中心文章了解详细信息,包括修复漏洞的截止日期。
ld/a/a/a/a/c/e$1; ld/a/a/a/a/c/f$1; sv:截止日期:2020 年 12 月 10 日
@Override
public void onCreate() {
super.onCreate();
hostnameVerifier();
MobileCore.setApplication(this);
SoLoader.init(this, /* native exopackage */ false);
ReactNativeFirebaseApp.setApplicationContext(this);
}
private void hostnameVerifier(){
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String arg0, SSLSession arg1) {
String hostList[] = {"in.appcenter.ms", "graph.facebook.com",
"assets.adobedtm.com", "codepushupdates.azureedge.net", "app-measurement.com",
"forter.com", "dmn1", "dmn2", "dmn3", "quantummetric.com", "urbanairship.com", "demdex.net", "search.unbxd.io",
"monetate.net", "bazaarvoice.com", "google.com", "stylitics.com", "getcandid.com","braintreegateway.com"
};
for (String host : hostList) {
if (host.contains(arg0) || arg0.endsWith(host)) {
return true;
}
}
return false;
}
});
}
我应该改变什么,请帮助。
解决方案
在 google play 控制台上,转到发布管理 -> 选择 apk 版本 -> 安全选项卡。在那里,您将看到该 apk 的安全问题列表以及代码中可能导致该安全问题的类。
如果您没有看到类名,而是在安全警告消息中看到一些编码代码,请通过禁用您可能使用的任何代码压缩工具来上传另一个构建。就我而言,它是 proguard,我禁用了它并获得了库名称。仅供参考 - 就我而言,图书馆是 Braintree
推荐阅读
- vba - 如何将 VBA 字符串转换为对象类型
- php - 在 Elastic Search 中进行词条查询
- python - TensorFlow 将模型导出转换保存到 tflite
- c# - VSTO / Excel使文件excel B嵌入到文件excel A中,以便B从A继承自定义属性和验证
- solr - 使用子查询时如何将子文档与父文档匹配?
- tfs - Team Foundation Server - 增加历史图表的项目数
- git - 如何检查我所在的分支是否基于远程跟踪分支的提交?
- nlp - 加载 fasttext 预训练德语词嵌入的 .vec 文件抛出内存错误
- html - Bootstrap 4 Dropdown 和 Animate.css 没有正确定位
- php - Glob 分页重写 url