Google Play 预发布报告存在安全漏洞,表明所有域均允许明文流量

Sar*_*mar 6 android android-security google-play-console android-vitals

Google Play 预发布报告安全漏洞

您的应用程序的网络安全配置允许所有域的明文流量。这可能允许窃听者拦截您的应用程序发送的数据。如果该数据敏感或用户可识别,则可能会影响用户的隐私。

考虑通过将cleartextTrafficPermissed标志设置为 false 或为特定域添加加密策略来仅允许加密流量。了解更多

网络安全配置.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>

    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system"/>
        </trust-anchors>
    </base-config>

    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">127.0.0.1</domain>
    </domain-config>
</network-security-config>
Run Code Online (Sandbox Code Playgroud)

AndroidManifest.xml

 <application
        android:name="com.example.MyActivity"
        android:allowBackup="false"
        tools:replace="allowBackup"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:theme="@style/AppTheme"
        android:hardwareAccelerated="true"
        android:resizeableActivity="false"
        android:networkSecurityConfig="@xml/network_security_config">
Run Code Online (Sandbox Code Playgroud)

我的疑问是,如果我将自己的域名域配置设置为cleartextTrafficPermission =“true”,例如

<domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">http://my-domain.com</domain>
</domain-config>
Run Code Online (Sandbox Code Playgroud)
  1. 它可以解决我的安全漏洞问题吗?
  2. 我需要知道是否需要为第三方广告网络设置域配置?

Sar*_*mar 9

下面的配置清除了Google Play安全漏洞

笔记:

  1. 我们在 android 馅饼中仅使用 https url
  2. 要在android pie中使用http,我们需要在domain-config中包含域名

<base-config cleartextTrafficPermitted="false">
    <trust-anchors>
        <certificates src="system"/>
    </trust-anchors>
</base-config>

<domain-config cleartextTrafficPermitted="true">
    <domain includeSubdomains="true">myowndomain.com</domain>
</domain-config>
Run Code Online (Sandbox Code Playgroud)