xref: /aosp_15_r20/system/sepolicy/prebuilts/api/32.0/private/app.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Worker# Allow apps to read the Test Harness Mode property. This property is used in
2*e4a36f41SAndroid Build Coastguard Worker# the implementation of ActivityManager.isDeviceInTestHarnessMode()
3*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, test_harness_prop)
4*e4a36f41SAndroid Build Coastguard Worker
5*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, boot_status_prop)
6*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, dalvik_config_prop)
7*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, media_config_prop)
8*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, packagemanager_config_prop)
9*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, radio_control_prop)
10*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, surfaceflinger_color_prop)
11*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, systemsound_config_prop)
12*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, telephony_config_prop)
13*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, userspace_reboot_config_prop)
14*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, vold_config_prop)
15*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, adbd_config_prop)
16*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, dck_prop)
17*e4a36f41SAndroid Build Coastguard Worker
18*e4a36f41SAndroid Build Coastguard Worker# Allow ART to be configurable via device_config properties
19*e4a36f41SAndroid Build Coastguard Worker# (ART "runs" inside the app process)
20*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, device_config_runtime_native_prop)
21*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, device_config_runtime_native_boot_prop)
22*e4a36f41SAndroid Build Coastguard Worker
23*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`perfetto_producer({ appdomain })')
24*e4a36f41SAndroid Build Coastguard Worker
25*e4a36f41SAndroid Build Coastguard Worker# Prevent apps from causing presubmit failures.
26*e4a36f41SAndroid Build Coastguard Worker# Apps can cause selinux denials by accessing CE storage
27*e4a36f41SAndroid Build Coastguard Worker# and/or external storage. In either case, the selinux denial is
28*e4a36f41SAndroid Build Coastguard Worker# not the cause of the failure, but just a symptom that
29*e4a36f41SAndroid Build Coastguard Worker# storage isn't ready. Many apps handle the failure appropriately.
30*e4a36f41SAndroid Build Coastguard Worker#
31*e4a36f41SAndroid Build Coastguard Worker# Apps cannot access external storage before it becomes available.
32*e4a36f41SAndroid Build Coastguard Workerdontaudit appdomain storage_stub_file:dir getattr;
33*e4a36f41SAndroid Build Coastguard Worker# Attempts to write to system_data_file is generally a sign
34*e4a36f41SAndroid Build Coastguard Worker# that apps are attempting to access encrypted storage before
35*e4a36f41SAndroid Build Coastguard Worker# the ACTION_USER_UNLOCKED intent is delivered. Apps are not
36*e4a36f41SAndroid Build Coastguard Worker# allowed to write to CE storage before it's available.
37*e4a36f41SAndroid Build Coastguard Worker# Attempting to do so will be blocked by both selinux and unix
38*e4a36f41SAndroid Build Coastguard Worker# permissions.
39*e4a36f41SAndroid Build Coastguard Workerdontaudit appdomain system_data_file:dir write;
40*e4a36f41SAndroid Build Coastguard Worker# Apps should not be reading vendor-defined properties.
41*e4a36f41SAndroid Build Coastguard Workerdontaudit appdomain vendor_default_prop:file read;
42*e4a36f41SAndroid Build Coastguard Worker
43*e4a36f41SAndroid Build Coastguard Worker# Access to /mnt/media_rw/<vol> (limited by DAC to apps with external_storage gid)
44*e4a36f41SAndroid Build Coastguard Workerallow appdomain mnt_media_rw_file:dir search;
45*e4a36f41SAndroid Build Coastguard Worker
46*e4a36f41SAndroid Build Coastguard Workerneverallow appdomain system_server:udp_socket {
47*e4a36f41SAndroid Build Coastguard Worker        accept append bind create ioctl listen lock name_bind
48*e4a36f41SAndroid Build Coastguard Worker        relabelfrom relabelto setattr shutdown };
49*e4a36f41SAndroid Build Coastguard Worker
50*e4a36f41SAndroid Build Coastguard Worker# Transition to a non-app domain.
51*e4a36f41SAndroid Build Coastguard Worker# Exception for the shell and su domains, can transition to runas, etc.
52*e4a36f41SAndroid Build Coastguard Worker# Exception for crash_dump to allow for app crash reporting.
53*e4a36f41SAndroid Build Coastguard Worker# Exception for renderscript binaries (/system/bin/bcc, /system/bin/ld.mc)
54*e4a36f41SAndroid Build Coastguard Worker# to allow renderscript to create privileged executable files.
55*e4a36f41SAndroid Build Coastguard Workerneverallow { appdomain -shell userdebug_or_eng(`-su') }
56*e4a36f41SAndroid Build Coastguard Worker    { domain -appdomain -crash_dump -rs }:process { transition };
57*e4a36f41SAndroid Build Coastguard Workerneverallow { appdomain -shell userdebug_or_eng(`-su') }
58*e4a36f41SAndroid Build Coastguard Worker    { domain -appdomain }:process { dyntransition };
59*e4a36f41SAndroid Build Coastguard Worker
60*e4a36f41SAndroid Build Coastguard Worker# Don't allow regular apps access to storage configuration properties.
61*e4a36f41SAndroid Build Coastguard Workerneverallow { appdomain -mediaprovider_app } storage_config_prop:file no_rw_file_perms;
62*e4a36f41SAndroid Build Coastguard Worker
63*e4a36f41SAndroid Build Coastguard Worker# Allow to read sendbug.preferred.domain
64*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, sendbug_config_prop)
65*e4a36f41SAndroid Build Coastguard Worker
66*e4a36f41SAndroid Build Coastguard Worker# Allow to read graphics related properties.
67*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, graphics_config_prop)
68*e4a36f41SAndroid Build Coastguard Worker
69*e4a36f41SAndroid Build Coastguard Worker# Allow to read persist.config.calibration_fac
70*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, camera_calibration_prop)
71*e4a36f41SAndroid Build Coastguard Worker
72*e4a36f41SAndroid Build Coastguard Worker# Allow to read db.log.detailed, db.log.slow_query_threshold*
73*e4a36f41SAndroid Build Coastguard Workerget_prop(appdomain, sqlite_log_prop)
74*e4a36f41SAndroid Build Coastguard Worker
75*e4a36f41SAndroid Build Coastguard Worker# Allow font file read by apps.
76*e4a36f41SAndroid Build Coastguard Workerallow appdomain font_data_file:file r_file_perms;
77*e4a36f41SAndroid Build Coastguard Workerallow appdomain font_data_file:dir r_dir_perms;
78*e4a36f41SAndroid Build Coastguard Worker
79*e4a36f41SAndroid Build Coastguard Worker# Enter /data/misc/apexdata/
80*e4a36f41SAndroid Build Coastguard Workerallow appdomain apex_module_data_file:dir search;
81*e4a36f41SAndroid Build Coastguard Worker# Read /data/misc/apexdata/com.android.art, execute signed AOT artifacts.
82*e4a36f41SAndroid Build Coastguard Workerallow appdomain apex_art_data_file:dir r_dir_perms;
83*e4a36f41SAndroid Build Coastguard Workerallow appdomain apex_art_data_file:file rx_file_perms;
84*e4a36f41SAndroid Build Coastguard Worker
85*e4a36f41SAndroid Build Coastguard Worker# Allow access to tombstones if an fd to one is given to you.
86*e4a36f41SAndroid Build Coastguard Worker# This is restricted by unix permissions, so an app must go through system_server to get one.
87*e4a36f41SAndroid Build Coastguard Workerallow appdomain tombstone_data_file:file { getattr read };
88*e4a36f41SAndroid Build Coastguard Workerneverallow appdomain tombstone_data_file:file ~{ getattr read };
89*e4a36f41SAndroid Build Coastguard Worker
90*e4a36f41SAndroid Build Coastguard Worker# Sensitive app domains are not allowed to execute from /data
91*e4a36f41SAndroid Build Coastguard Worker# to prevent persistence attacks and ensure all code is executed
92*e4a36f41SAndroid Build Coastguard Worker# from read-only locations.
93*e4a36f41SAndroid Build Coastguard Workerneverallow {
94*e4a36f41SAndroid Build Coastguard Worker  bluetooth
95*e4a36f41SAndroid Build Coastguard Worker  isolated_app
96*e4a36f41SAndroid Build Coastguard Worker  nfc
97*e4a36f41SAndroid Build Coastguard Worker  radio
98*e4a36f41SAndroid Build Coastguard Worker  shared_relro
99*e4a36f41SAndroid Build Coastguard Worker  system_app
100*e4a36f41SAndroid Build Coastguard Worker} {
101*e4a36f41SAndroid Build Coastguard Worker  data_file_type
102*e4a36f41SAndroid Build Coastguard Worker  -apex_art_data_file
103*e4a36f41SAndroid Build Coastguard Worker  -dalvikcache_data_file
104*e4a36f41SAndroid Build Coastguard Worker  -system_data_file # shared libs in apks
105*e4a36f41SAndroid Build Coastguard Worker  -apk_data_file
106*e4a36f41SAndroid Build Coastguard Worker}:file no_x_file_perms;
107