我们正在使用Fortify扫描我的Android源代码,但我无法摆脱这个问题:
类别:Android不良做法:缺少Google Play服务更新的安全提供程序(1个问题)
Fortify指向以下代码行:
tools:replace =“ android:allowBackup”>
AndroidManifest.xml:37 null()
<application
android:name=".test"
android:allowBackup="false"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:allowBackup"> <!--FORTIFY POINTS TO THIS LINE-->
Run Code Online (Sandbox Code Playgroud)
强化建议:
修补安全提供程序的最简单方法是调用同步方法installIfNeeded()。如果用户体验在等待操作完成时不受线程阻塞的影响,那么这是适当的,否则应以异步方式完成。
有关此问题的更多信息
我已关注Android的“ 更新您的安全提供商”以防御SSL漏洞
并尝试了两种方法:
installIfNeed() 和installIfNeededAsync()
但是问题仍然存在。我测试我的代码,它工作正常。
这是我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="test">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".test"
android:allowBackup="false"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:allowBackup">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<provider
android:name=".syncadapter.StubProvider"
android:authorities="com.neseapl.nyp.provider"
android:exported="false"
android:syncable="true"/>
<service
android:name=".syncadapter.SyncService"
android:exported="false">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/syncadapter" />
</service>
<service …Run Code Online (Sandbox Code Playgroud)