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

Unverified Commit 40e6e93c authored by Kevin F. Haggerty's avatar Kevin F. Haggerty
Browse files

Merge tag 'android-security-9.0.0_r62' into staging/lineage-16.0_merge-android-security-9.0.0_r62

Android security 9.0.0 release 62

* tag 'refs/tags/android-security-9.0.0_r62':
  [WIFI] Make Aware + Connectivity agent network specifiers sensitive
  [CS] Add an option to block sensitive network specifier
  Accept repeated locale as an input of LocaleList construction.
  Sanitize more of the notification text fields
  DO NOT MERGE Don't allow non-instant permissions for instant apps.

Change-Id: Ie83a9f0d9388a606e08dae862ff478948ddf3da8
parents 800b3e1f 5263e868
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ public class Notification implements Parcelable
     * <p>
     * Avoids spamming the system with overly large strings such as full e-mails.
     */
    private static final int MAX_CHARSEQUENCE_LENGTH = 5 * 1024;
    private static final int MAX_CHARSEQUENCE_LENGTH = 1024;

    /**
     * Maximum entries of reply text that are accepted by Builder and friends.
@@ -7240,7 +7240,7 @@ public class Notification implements Parcelable
             */
            public Message(@NonNull CharSequence text, long timestamp, @Nullable Person sender,
                    boolean remoteInputHistory) {
                mText = text;
                mText = safeCharSequence(text);
                mTimestamp = timestamp;
                mSender = sender;
                mRemoteInputHistory = remoteInputHistory;
@@ -7350,7 +7350,7 @@ public class Notification implements Parcelable
                bundle.putLong(KEY_TIMESTAMP, mTimestamp);
                if (mSender != null) {
                    // Legacy listeners need this
                    bundle.putCharSequence(KEY_SENDER, mSender.getName());
                    bundle.putCharSequence(KEY_SENDER, safeCharSequence(mSender.getName()));
                    bundle.putParcelable(KEY_SENDER_PERSON, mSender);
                }
                if (mDataMimeType != null) {
+26 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package android.net;

/**
 * Describes specific properties of a network for use in a {@link NetworkRequest}.
 * Describes specific properties of a requested network for use in a {@link NetworkRequest}.
 *
 * Applications cannot instantiate this class by themselves, but can obtain instances of
 * subclasses of this class via other APIs.
@@ -49,4 +49,29 @@ public abstract class NetworkSpecifier {
    public void assertValidFromUid(int requestorUid) {
        // empty
    }

    /**
     * Optional method which can be overridden by concrete implementations of NetworkSpecifier to
     * perform any redaction of information from the NetworkSpecifier, e.g. if it contains
     * sensitive information. The default implementation simply returns the object itself - i.e.
     * no information is redacted. A concrete implementation may return a modified (copy) of the
     * NetworkSpecifier, or even return a null to fully remove all information.
     * <p>
     * This method is relevant to NetworkSpecifier objects used by agents - those are shared with
     * apps by default. Some agents may store sensitive matching information in the specifier,
     * e.g. a Wi-Fi SSID (which should not be shared since it may leak location). Those classes
     * can redact to a null. Other agents use the Network Specifier to share public information
     * with apps - those should not be redacted.
     * <p>
     * The default implementation redacts no information.
     *
     * @return A NetworkSpecifier object to be passed along to the requesting app.
     *
     * @hide
     */
    public NetworkSpecifier redact() {
        // TODO (b/122160111): convert default to null once all platform NetworkSpecifiers
        // implement this method.
        return this;
    }
}
+6 −5
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.util.proto.ProtoOutputStream;

import com.android.internal.annotations.GuardedBy;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
@@ -171,18 +172,18 @@ public final class LocaleList implements Parcelable {
    /**
     * Creates a new {@link LocaleList}.
     *
     * If two or more same locales are passed, the repeated locales will be dropped.
     * <p>For empty lists of {@link Locale} items it is better to use {@link #getEmptyLocaleList()},
     * which returns a pre-constructed empty list.</p>
     *
     * @throws NullPointerException if any of the input locales is <code>null</code>.
     * @throws IllegalArgumentException if any of the input locales repeat.
     */
    public LocaleList(@NonNull Locale... list) {
        if (list.length == 0) {
            mList = sEmptyList;
            mStringRepresentation = "";
        } else {
            final Locale[] localeList = new Locale[list.length];
            final ArrayList<Locale> localeList = new ArrayList<>();
            final HashSet<Locale> seenLocales = new HashSet<Locale>();
            final StringBuilder sb = new StringBuilder();
            for (int i = 0; i < list.length; i++) {
@@ -190,10 +191,10 @@ public final class LocaleList implements Parcelable {
                if (l == null) {
                    throw new NullPointerException("list[" + i + "] is null");
                } else if (seenLocales.contains(l)) {
                    throw new IllegalArgumentException("list[" + i + "] is a repetition");
                    // Dropping duplicated locale entries.
                } else {
                    final Locale localeClone = (Locale) l.clone();
                    localeList[i] = localeClone;
                    localeList.add(localeClone);
                    sb.append(localeClone.toLanguageTag());
                    if (i < list.length - 1) {
                        sb.append(',');
@@ -201,7 +202,7 @@ public final class LocaleList implements Parcelable {
                    seenLocales.add(localeClone);
                }
            }
            mList = localeList;
            mList = localeList.toArray(new Locale[localeList.size()]);
            mStringRepresentation = sb.toString();
        }
    }
+5 −1
Original line number Diff line number Diff line
@@ -1433,6 +1433,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
            newNc.setUids(null);
            newNc.setSSID(null);
        }
        if (newNc.getNetworkSpecifier() != null) {
            newNc.setNetworkSpecifier(newNc.getNetworkSpecifier().redact());
        }
        return newNc;
    }

@@ -5145,7 +5148,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
        }
        switch (notificationType) {
            case ConnectivityManager.CALLBACK_AVAILABLE: {
                putParcelable(bundle, new NetworkCapabilities(networkAgent.networkCapabilities));
                putParcelable(bundle, networkCapabilitiesRestrictedForCallerPermissions(
                        networkAgent.networkCapabilities, nri.mPid, nri.mUid));
                putParcelable(bundle, new LinkProperties(networkAgent.linkProperties));
                break;
            }
+23 −11
Original line number Diff line number Diff line
@@ -3787,14 +3787,10 @@ public class PackageManagerService extends IPackageManager.Stub
        Iterator<ResolveInfo> iter = matches.iterator();
        while (iter.hasNext()) {
            final ResolveInfo rInfo = iter.next();
            final PackageSetting ps = mSettings.mPackages.get(rInfo.activityInfo.packageName);
            if (ps != null) {
                final PermissionsState permissionsState = ps.getPermissionsState();
                if (permissionsState.hasPermission(Manifest.permission.INSTALL_PACKAGES, 0)
                        || Build.IS_ENG) {
            if (checkPermission(Manifest.permission.INSTALL_PACKAGES,
                    rInfo.activityInfo.packageName, 0) == PERMISSION_GRANTED || Build.IS_ENG) {
                continue;
            }
            }
            iter.remove();
        }
        if (matches.size() == 0) {
@@ -4036,8 +4032,24 @@ public class PackageManagerService extends IPackageManager.Stub
            final int[] gids = (flags & PackageManager.GET_GIDS) == 0
                    ? EMPTY_INT_ARRAY : permissionsState.computeGids(userId);
            // Compute granted permissions only if package has requested permissions
            final Set<String> permissions = ArrayUtils.isEmpty(p.requestedPermissions)
            Set<String> permissions = ArrayUtils.isEmpty(p.requestedPermissions)
                    ? Collections.<String>emptySet() : permissionsState.getPermissions(userId);
            if (state.instantApp) {
                permissions = new ArraySet<>(permissions);
                permissions.removeIf(permissionName -> {
                    BasePermission permission = mPermissionManager.getPermissionTEMP(
                            permissionName);
                    if (permission == null) {
                        return true;
                    }
                    if (!permission.isInstant()) {
                        EventLog.writeEvent(0x534e4554, "140256621", UserHandle.getUid(userId,
                                ps.appId), permissionName);
                        return true;
                    }
                    return false;
                });
            }
            PackageInfo packageInfo = PackageParser.generatePackageInfo(p, gids, flags,
                    ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId);
@@ -8035,10 +8047,9 @@ public class PackageManagerService extends IPackageManager.Stub
    private void addPackageHoldingPermissions(ArrayList<PackageInfo> list, PackageSetting ps,
            String[] permissions, boolean[] tmp, int flags, int userId) {
        int numMatch = 0;
        final PermissionsState permissionsState = ps.getPermissionsState();
        for (int i=0; i<permissions.length; i++) {
            final String permission = permissions[i];
            if (permissionsState.hasPermission(permission, userId)) {
            if (checkPermission(permission, ps.name, userId) == PERMISSION_GRANTED) {
                tmp[i] = true;
                numMatch++;
            } else {
@@ -19157,7 +19168,8 @@ public class PackageManagerService extends IPackageManager.Stub
        }
        final int userId = user == null ? UserHandle.USER_ALL : user.getIdentifier();
        if (ps.getPermissionsState().hasPermission(Manifest.permission.SUSPEND_APPS, userId)) {
        if (checkPermission(Manifest.permission.SUSPEND_APPS, packageName, userId)
                 == PERMISSION_GRANTED) {
            unsuspendForSuspendingPackage(packageName, userId);
        }
Loading