blob: 53c31c23cc698ec925730a2ac54315857e0e53ea [file] [log] [blame]
Alex Klyubinb5853c32017-01-05 17:18:32 -08001###
2### Apps that run with the system UID, e.g. com.android.system.ui,
3### com.android.settings. These are not as privileged as the system
4### server.
5###
6
Alan Stokes81e4e872020-02-11 14:43:05 +00007typeattribute system_app coredomain, mlstrustedsubject;
Alex Klyubinb5853c32017-01-05 17:18:32 -08008
dcashman3e8dbf02016-12-08 11:23:34 -08009app_domain(system_app)
Alex Klyubinb5853c32017-01-05 17:18:32 -080010net_domain(system_app)
11binder_service(system_app)
12
Jeff Vander Stoepa12aad42017-07-10 20:39:50 -070013# android.ui and system.ui
14allow system_app rootfs:dir getattr;
15
Alex Klyubinb5853c32017-01-05 17:18:32 -080016# Read and write /data/data subdirectory.
17allow system_app system_app_data_file:dir create_dir_perms;
18allow system_app system_app_data_file:{ file lnk_file } create_file_perms;
19
20# Read and write to /data/misc/user.
21allow system_app misc_user_data_file:dir create_dir_perms;
22allow system_app misc_user_data_file:file create_file_perms;
23
24# Access to vold-mounted storage for measuring free space
25allow system_app mnt_media_rw_file:dir search;
26
Andrew Sapperstein544a9b12019-06-28 15:28:28 +000027# Access to apex files stored on /data (b/136063500)
28# Needed so that Settings can access NOTICE files inside apex
29# files located in the assets/ directory.
30allow system_app apex_data_file:dir search;
31allow system_app staging_data_file:file r_file_perms;
32
Alex Klyubinb5853c32017-01-05 17:18:32 -080033# Read wallpaper file.
34allow system_app wallpaper_file:file r_file_perms;
35
36# Read icon file.
37allow system_app icon_file:file r_file_perms;
38
39# Write to properties
Jaekyun Seok224921d2018-04-09 12:07:32 +090040set_prop(system_app, bluetooth_a2dp_offload_prop)
Cheney Nie55a74b2019-03-18 11:07:32 +080041set_prop(system_app, bluetooth_audio_hal_prop)
Alex Klyubinb5853c32017-01-05 17:18:32 -080042set_prop(system_app, bluetooth_prop)
43set_prop(system_app, debug_prop)
44set_prop(system_app, system_prop)
Jaekyun Seok224921d2018-04-09 12:07:32 +090045set_prop(system_app, exported_bluetooth_prop)
Jaekyun Seoke4971452017-10-19 16:54:49 +090046set_prop(system_app, exported_system_prop)
Jaekyun Seoke4971452017-10-19 16:54:49 +090047set_prop(system_app, exported3_system_prop)
Alex Klyubinb5853c32017-01-05 17:18:32 -080048set_prop(system_app, logd_prop)
49set_prop(system_app, net_radio_prop)
Inseob Kimdc1e5012020-04-27 21:13:01 +090050set_prop(system_app, usb_control_prop)
51set_prop(system_app, usb_prop)
Alex Klyubinb5853c32017-01-05 17:18:32 -080052set_prop(system_app, log_tag_prop)
53userdebug_or_eng(`set_prop(system_app, logpersistd_logging_prop)')
54auditallow system_app net_radio_prop:property_service set;
Inseob Kimdc1e5012020-04-27 21:13:01 +090055auditallow system_app usb_control_prop:property_service set;
56auditallow system_app usb_prop:property_service set;
Hung-ying Tyan565384d2019-04-26 16:14:52 +080057# Allow Settings to enable Dynamic System Update
58set_prop(system_app, dynamic_system_prop)
Alex Klyubinb5853c32017-01-05 17:18:32 -080059
60# ctl interface
61set_prop(system_app, ctl_default_prop)
62set_prop(system_app, ctl_bugreport_prop)
63
Howard Chen7833aa42020-03-19 18:58:11 +080064# Allow developer settings to query gsid status
65get_prop(system_app, gsid_prop)
66
Alex Klyubinb5853c32017-01-05 17:18:32 -080067# Create /data/anr/traces.txt.
68allow system_app anr_data_file:dir ra_dir_perms;
69allow system_app anr_data_file:file create_file_perms;
70
71# Settings need to access app name and icon from asec
72allow system_app asec_apk_file:file r_file_perms;
73
Songchun Fan020e3ab2020-02-04 12:39:45 -080074# Allow system_app (adb data loader) to write data to /data/incremental
75allow system_app apk_data_file:file write;
76
Songchun Fan39222532020-02-13 08:38:36 -080077# Allow system app (adb data loader) to read logs
78allow system_app incremental_control_file:file r_file_perms;
79
Bookatz022ab0e2018-02-13 09:33:36 -080080# Allow system apps (like Settings) to interact with statsd
81binder_call(system_app, statsd)
82
Joe Onorato41f93db2016-11-20 23:23:04 -080083# Allow system apps to interact with incidentd
84binder_call(system_app, incidentd)
85
Rambo Wang8950e7a2020-02-12 19:06:04 -080086# Allow system app to interact with Dumpstate HAL
87hal_client_domain(system_app, hal_dumpstate)
88
Alex Klyubinb5853c32017-01-05 17:18:32 -080089allow system_app servicemanager:service_manager list;
90# TODO: scope this down? Too broad?
Dan Cashman91d398d2017-09-26 12:58:29 -070091allow system_app {
92 service_manager_type
Martijn Coenenac097ac2018-08-17 09:35:42 +020093 -apex_service
Luke Huang524f25e2019-02-25 20:12:15 +080094 -dnsresolver_service
Dan Cashman91d398d2017-09-26 12:58:29 -070095 -dumpstate_service
96 -installd_service
Igor Murashkin72a88b12018-10-05 14:48:29 -070097 -iorapd_service
Yifan Hong18ade862019-03-14 15:45:03 -070098 -lpdump_service
Dan Cashman91d398d2017-09-26 12:58:29 -070099 -netd_service
Michael Sun6445f192020-11-02 23:54:21 +0000100 -system_suspend_control_internal_service
Tri Vo131fa732019-02-07 13:29:39 -0800101 -system_suspend_control_service
Dan Cashman91d398d2017-09-26 12:58:29 -0700102 -virtual_touchpad_service
103 -vold_service
104 -vr_hwc_service
Steven Morelanda30464c2020-01-21 10:18:57 -0800105 -default_android_service
Dan Cashman91d398d2017-09-26 12:58:29 -0700106}:service_manager find;
Jeff Vander Stoep2d32d812017-10-13 13:33:46 -0700107# suppress denials for services system_app should not be accessing.
108dontaudit system_app {
Luke Huang524f25e2019-02-25 20:12:15 +0800109 dnsresolver_service
Jeff Vander Stoep2d32d812017-10-13 13:33:46 -0700110 dumpstate_service
111 installd_service
Igor Murashkin72a88b12018-10-05 14:48:29 -0700112 iorapd_service
Jeff Vander Stoep2d32d812017-10-13 13:33:46 -0700113 netd_service
114 virtual_touchpad_service
115 vold_service
116 vr_hwc_service
117}:service_manager find;
Alex Klyubinb5853c32017-01-05 17:18:32 -0800118
119allow system_app keystore:keystore_key {
120 get_state
121 get
122 insert
123 delete
124 exist
125 list
126 reset
127 password
128 lock
129 unlock
130 is_empty
131 sign
132 verify
133 grant
134 duplicate
135 clear_uid
136 user_changed
137};
138
Janis Danisevskisabb93f22020-07-27 12:53:20 -0700139allow system_app keystore:keystore2_key {
140 delete
141 get_info
142 grant
Janis Danisevskisabb93f22020-07-27 12:53:20 -0700143 rebind
144 update
145 use
146};
147
Tri Vo06d7dca2018-01-10 12:51:51 -0800148# settings app reads /proc/version
Jeff Vander Stoepc975bd92017-09-27 12:27:03 -0700149allow system_app {
Jeff Vander Stoepc975bd92017-09-27 12:27:03 -0700150 proc_version
151}:file r_file_perms;
Jeff Vander Stoepc15d54e2017-07-25 16:43:49 -0700152
Tri Vof55c9892018-10-10 22:48:15 +0000153# Settings app writes to /dev/stune/foreground/tasks.
154allow system_app cgroup:file w_file_perms;
155
Alex Klyubinb5853c32017-01-05 17:18:32 -0800156control_logd(system_app)
Mark Salyzynd33a9a12016-11-07 15:11:39 -0800157read_runtime_log_tags(system_app)
Pavel Grafov118e4962018-01-18 17:22:28 +0000158get_prop(system_app, device_logging_prop)
Nick Kralevich45766d42017-04-26 11:40:48 -0700159
Nathan Haroldee268642017-12-14 18:20:30 -0800160# allow system apps to use UDP sockets provided by the system server but not
161# modify them other than to connect
Nathan Harold252b0152018-03-27 06:34:54 -0700162allow system_app system_server:udp_socket {
163 connect getattr read recvfrom sendto write getopt setopt };
Nathan Haroldee268642017-12-14 18:20:30 -0800164
Inseob Kimc80b0242020-07-16 22:25:47 +0900165# Settings app reads ro.oem_unlock_supported
166get_prop(system_app, oem_unlock_prop)
167
Janis Danisevskis202e8632020-10-23 11:16:34 -0700168# TODO Remove this property when Keystore 2.0 migration is complete b/171563717
169get_prop(system_app, keystore2_enable_prop)
170
Nick Kralevich45766d42017-04-26 11:40:48 -0700171###
172### Neverallow rules
173###
174
175# app domains which access /dev/fuse should not run as system_app
176neverallow system_app fuse_device:chr_file *;
Nick Kralevich6e893ec2019-09-05 09:24:41 -0700177
178# Apps which run as UID=system should not rely on any attacker controlled
179# filesystem locations, such as /data/local/tmp. For /data/local/tmp, we
180# allow writes to files passed by file descriptor to support dumpstate and
181# bug reports, but not reads.
182neverallow system_app shell_data_file:dir { no_w_dir_perms open search read };
183neverallow system_app shell_data_file:file { open read ioctl lock };