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

Commit aeb283a2 authored by Jackal Guo's avatar Jackal Guo
Browse files

Mitigate the app visibility gap

Combining the two SecurityException check in verifyCallingPackage
to mitigate the potential information leakage.

Bug: 205707373
Test: atest CtsAdminTestCases
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Test: manually using the PoC in the buganizer to ensure the symptom
      no longer exists.
Change-Id: Iebc4a8c0daf6a31a3863aed4e9d13d2a3ad28b78
parent 2969e9b0
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -2688,11 +2688,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        final DevicePolicyData policy = getUserData(userId);
        if (who != null) {
            ActiveAdmin admin = policy.mAdminMap.get(who);
            if (admin == null) {
                throw new SecurityException("No active admin " + who);
            }
            if (admin.getUid() != uid) {
                throw new SecurityException("Admin " + who + " is not owned by uid " + uid);
            if (admin == null || admin.getUid() != uid) {
                throw new SecurityException(
                        "Admin " + who + " is not active or not owned by uid " + uid);
            }
            if (isActiveAdminWithPolicyForUserLocked(admin, reqPolicy, userId)) {
                return admin;