blob: 26d884ef3d9a8c08ef75b559e3a800dd67a9111c [file] [log] [blame]
Alex Klyubinbaeac1f2017-01-09 15:34:27 -08001###
2### Ephemeral apps.
3###
4### This file defines the security policy for apps with the ephemeral
5### feature.
6###
7### The ephemeral_app domain is a reduced permissions sandbox allowing
8### ephemeral applications to be safely installed and run. Non ephemeral
9### applications may also opt-in to ephemeral to take advantage of the
10### additional security features.
11###
12### PackageManager flags an app as ephemeral at install time.
13
14net_domain(ephemeral_app)
Chad Brubaker5c566d12017-01-17 13:28:24 -080015app_domain(ephemeral_app)
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080016
17# App sandbox file accesses.
18allow ephemeral_app ephemeral_data_file:dir create_dir_perms;
19allow ephemeral_app ephemeral_data_file:{ file sock_file fifo_file } create_file_perms;
20
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080021# Allow apps to read/execute installed binaries
Chad Brubaker5c566d12017-01-17 13:28:24 -080022allow ephemeral_app ephemeral_apk_data_file:dir r_dir_perms;
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080023allow ephemeral_app ephemeral_apk_data_file:file { r_file_perms execute };
24
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080025# services
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080026allow ephemeral_app surfaceflinger_service:service_manager find;
Chad Brubaker5c566d12017-01-17 13:28:24 -080027allow ephemeral_app radio_service:service_manager find;
28# TODO: Replace app_api_service with a smaller ephemeral_api_service
29allow ephemeral_app app_api_service:service_manager find;
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080030
31###
32### neverallow rules
33###
34
35# Executable content should never be loaded from an ephemeral app home directory.
36neverallow ephemeral_app ephemeral_data_file:file { execute execute_no_trans };
37
38# Receive or send uevent messages.
39neverallow ephemeral_app domain:netlink_kobject_uevent_socket *;
40
41# Receive or send generic netlink messages
42neverallow ephemeral_app domain:netlink_socket *;
43
44# Too much leaky information in debugfs. It's a security
45# best practice to ensure these files aren't readable.
46neverallow ephemeral_app debugfs:file read;
47
48# execute gpu_device
49neverallow ephemeral_app gpu_device:chr_file execute;
50
51# access files in /sys with the default sysfs label
52neverallow ephemeral_app sysfs:file *;
53
54# Avoid reads from generically labeled /proc files
55# Create a more specific label if needed
56neverallow ephemeral_app proc:file { no_rw_file_perms no_x_file_perms };