Verify all possible hosts that match web nav

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
Merged-In: If9ef0fc53d96e6581c56d86f89fe63bc9a5fb89a
(cherry picked from commit 1fba0f897f)
This commit is contained in:
Christopher Tate
2020-02-25 17:48:49 -08:00
committed by Chris Tate
parent b51f33f4cd
commit d04ec018d5

View File

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