Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcc46336 authored by Chad Brubaker's avatar Chad Brubaker
Browse files

Change cleartext traffic permitted default for P apps

For applications targeting P and above the network security
config's cleartextTrafficPermitted will default to false instead of
the previous true.

Bug: 63931636
Test: network security config cts tests
Change-Id: Ia697358ad84e2092443c3eff518003c6a11e4630
parent 5ac2ea1b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -164,7 +164,8 @@ public final class NetworkSecurityConfig {
     * <p>
     * The default configuration has the following properties:
     * <ol>
     * <li>Cleartext traffic is permitted for non-ephemeral apps.</li>
     * <li>If the application targets API level 27 (Android O MR1) or lower then cleartext traffic
     * is allowed by default.</li>
     * <li>Cleartext traffic is not permitted for ephemeral apps.</li>
     * <li>HSTS is not enforced.</li>
     * <li>No certificate pinning is used.</li>
@@ -183,7 +184,8 @@ public final class NetworkSecurityConfig {
                // System certificate store, does not bypass static pins.
                .addCertificatesEntryRef(
                        new CertificatesEntryRef(SystemCertificateSource.getInstance(), false));
        final boolean cleartextTrafficPermitted = info.targetSandboxVersion < 2;
        final boolean cleartextTrafficPermitted = info.targetSdkVersion < Build.VERSION_CODES.P
                && info.targetSandboxVersion < 2;
        builder.setCleartextTrafficPermitted(cleartextTrafficPermitted);
        // Applications targeting N and above must opt in into trusting the user added certificate
        // store.