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

Commit aab67c2b authored by Patrick Baumann's avatar Patrick Baumann
Browse files

Don't assume host is wildcard if not provided

This change ensures that while parsing a package, we require an explicit
wildcard in the queries->intent->data->host field. Prior to this change,
we were defaulting to wildcard when not provided. This resulted in,
e.g. someone trying to get visibility to just browsers actually getting
access to all packages that handle any web intent.

Fixes: 160868841
Test: atest AppEnumerationTests IntentFilterTest
Change-Id: I771845467928b6655fe19efe89bd2ca548dca6e5
parent 2d695313
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1168,8 +1168,13 @@ public class IntentFilter implements Parcelable {
        public int match(Uri data, boolean wildcardSupported) {
            String host = data.getHost();
            if (host == null) {
                if (wildcardSupported && mWild) {
                    // special case, if no host is provided, but the Authority is wildcard, match
                    return MATCH_CATEGORY_HOST;
                } else {
                    return NO_MATCH_DATA;
                }
            }
            if (false) Log.v("IntentFilter",
                    "Match host " + host + ": " + mHost);
            if (!wildcardSupported || !WILDCARD.equals(host)) {
+1 −1
Original line number Diff line number Diff line
@@ -1510,7 +1510,7 @@ public class ParsingPackageUtils {

                Uri data = null;
                String dataType = null;
                String host = IntentFilter.WILDCARD;
                String host = null;
                final int numActions = intentInfo.countActions();
                final int numSchemes = intentInfo.countDataSchemes();
                final int numTypes = intentInfo.countDataTypes();