Skip to content

Commit 704249a

Browse files
muhomorrthestinger
authored andcommitted
don't allow to install APEXes on user builds
APEX installation support slightly increases the attack surface.
1 parent cb6edfe commit 704249a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

services/core/java/com/android/server/pm/PackageInstallerService.java

+3
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,9 @@ int createSessionInternal(SessionParams params, String installerPackageName,
831831
== PackageManager.PERMISSION_DENIED) {
832832
throw new SecurityException("Not allowed to perform APEX updates");
833833
}
834+
if (Build.IS_USER) {
835+
throw new SecurityException("Not allowed to perform APEX updates on user builds");
836+
}
834837
} else if (params.isStaged) {
835838
mContext.enforceCallingOrSelfPermission(Manifest.permission.INSTALL_PACKAGES, TAG);
836839
}

services/core/java/com/android/server/pm/PackageInstallerSession.java

+5
Original file line numberDiff line numberDiff line change
@@ -3456,6 +3456,11 @@ boolean containsApkSession() {
34563456
@GuardedBy("mLock")
34573457
private void validateApexInstallLocked()
34583458
throws PackageManagerException {
3459+
if (Build.IS_USER) {
3460+
throw new PackageManagerException(PackageManager.INSTALL_FAILED_SESSION_INVALID,
3461+
"APEX installation is not allowed on user builds");
3462+
}
3463+
34593464
final List<File> addedFiles = getAddedApksLocked();
34603465
if (addedFiles.isEmpty()) {
34613466
throw new PackageManagerException(INSTALL_FAILED_INVALID_APK,

0 commit comments

Comments
 (0)