OSDN Git Service

Verify all possible hosts that match web nav
authorChristopher Tate <ctate@google.com>
Wed, 26 Feb 2020 01:48:49 +0000 (17:48 -0800)
committerChris Tate <ctate@android.com>
Thu, 27 Feb 2020 22:23:42 +0000 (22:23 +0000)
Even if an <intent-filter> matches non-web schemes in addition to http
or https, make sure to include its cited hosts in the autoVerify
evaluation.

Bug: 150038428
Test: atest OsHostTests#testIntentFilterHostValidation
Change-Id: If9ef0fc53d96e6581c56d86f89fe63bc9a5fb89a

services/core/java/com/android/server/pm/PackageManagerService.java

index 36843d4..ed22b21 100644 (file)
@@ -17257,11 +17257,13 @@ public class PackageManagerService extends IPackageManager.Stub
             // and whether there are any web-nav filters that fit the profile for running
             // a verification pass now.
             if (needToVerify) {
+                final boolean needsVerification = needsNetworkVerificationLPr(packageName);
                 final int verificationId = mIntentFilterVerificationToken++;
                 for (ParsedActivity a : activities) {
                     for (ParsedIntentInfo filter : a.getIntents()) {
-                        if (filter.handlesWebUris(true)
-                                && needsNetworkVerificationLPr(a.getPackageName())) {
+                        // Run verification against hosts mentioned in any web-nav intent filter,
+                        // even if the filter matches non-web schemes as well
+                        if (needsVerification && filter.handlesWebUris(false)) {
                             if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
                                     "Verification needed for IntentFilter:" + filter.toString());
                             mIntentFilterVerifier.addOneIntentFilterVerification(