Merge "[DO NOT MERGE] Don't allow permission change to runtime" into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c8dac8d6f6
@@ -12567,6 +12567,20 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
+ perm.info.name + "; ignoring new declaration");
|
||||
pkg.permissions.remove(i);
|
||||
}
|
||||
} else if (!"android".equals(pkg.packageName)) {
|
||||
// Prevent apps to change protection level to dangerous from any other
|
||||
// type as this would allow a privilege escalation where an app adds a
|
||||
// normal/signature permission in other app's group and later redefines
|
||||
// it as dangerous leading to the group auto-grant.
|
||||
if ((perm.info.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE)
|
||||
== PermissionInfo.PROTECTION_DANGEROUS) {
|
||||
if (bp != null && !bp.isRuntime()) {
|
||||
Slog.w(TAG, "Package " + pkg.packageName + " trying to change a "
|
||||
+ "non-runtime permission " + perm.info.name
|
||||
+ " to runtime; keeping old protection level");
|
||||
perm.info.protectionLevel = bp.protectionLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user