From bdac15aa887933f13fcdfff3669323d7a1717fb0 Mon Sep 17 00:00:00 2001 From: "Philip P. Moltmann" <moltmann@google.com> Date: Fri, 21 Jul 2017 13:55:11 -0700 Subject: [PATCH] Allow untrusted apps to read apks Bug: 37281396 Test: cts-tradefed run cts-dev -m CtsContentTestCases --test=android.content.pm.cts.InstallSessionTransferTest Change-Id: If2094057d1acfbbf007ae108225decd9ad70e459 --- private/app.te | 5 ++++- private/untrusted_app_all.te | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/private/app.te b/private/app.te index 37f3fc29c..9251ed9cb 100644 --- a/private/app.te +++ b/private/app.te @@ -474,9 +474,12 @@ neverallow appdomain { create write setattr relabelfrom relabelto append unlink link rename }; # access tmp apk files -neverallow { appdomain -platform_app -priv_app } +neverallow { appdomain -untrusted_app_all -platform_app -priv_app } { apk_tmp_file apk_private_tmp_file }:dir_file_class_set *; +neverallow untrusted_app_all { apk_tmp_file apk_private_tmp_file }:{ devfile_class_set dir fifo_file lnk_file sock_file } *; +neverallow untrusted_app_all { apk_tmp_file apk_private_tmp_file }:file ~{ getattr read }; + # Access to factory files. neverallow appdomain efs_file:dir_file_class_set write; neverallow { appdomain -shell } efs_file:dir_file_class_set read; diff --git a/private/untrusted_app_all.te b/private/untrusted_app_all.te index 6218b0bb7..cce589ea2 100644 --- a/private/untrusted_app_all.te +++ b/private/untrusted_app_all.te @@ -41,6 +41,9 @@ allow untrusted_app_all asec_public_file:file { execute execmod }; allow untrusted_app_all shell_data_file:file r_file_perms; allow untrusted_app_all shell_data_file:dir r_dir_perms; +# Allow to read staged apks. +allow untrusted_app_all { apk_tmp_file apk_private_tmp_file }:file {read getattr}; + # Read and write system app data files passed over Binder. # Motivating case was /data/data/com.android.settings/cache/*.jpg for # cropping or taking user photos. -- GitLab