blob: b4a21814b00863e0f08a472b2529f1701685a5a8 [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
Chad Brubaker3d348fd2017-01-19 10:42:40 -080017# Allow ephemeral apps to read/write files in visible storage if provided fds
18allow ephemeral_app { sdcard_type media_rw_data_file }:file {read write getattr ioctl lock append};
19
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080020# services
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080021allow ephemeral_app surfaceflinger_service:service_manager find;
Chad Brubaker5c566d12017-01-17 13:28:24 -080022allow ephemeral_app radio_service:service_manager find;
23# TODO: Replace app_api_service with a smaller ephemeral_api_service
24allow ephemeral_app app_api_service:service_manager find;
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080025
26###
27### neverallow rules
28###
29
30# Executable content should never be loaded from an ephemeral app home directory.
Chad Brubaker4c40d732017-01-25 14:55:56 -080031neverallow ephemeral_app app_data_file:file { execute execute_no_trans };
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080032
33# Receive or send uevent messages.
34neverallow ephemeral_app domain:netlink_kobject_uevent_socket *;
35
36# Receive or send generic netlink messages
37neverallow ephemeral_app domain:netlink_socket *;
38
39# Too much leaky information in debugfs. It's a security
40# best practice to ensure these files aren't readable.
41neverallow ephemeral_app debugfs:file read;
42
43# execute gpu_device
44neverallow ephemeral_app gpu_device:chr_file execute;
45
46# access files in /sys with the default sysfs label
47neverallow ephemeral_app sysfs:file *;
48
49# Avoid reads from generically labeled /proc files
50# Create a more specific label if needed
51neverallow ephemeral_app proc:file { no_rw_file_perms no_x_file_perms };
Chad Brubaker3d348fd2017-01-19 10:42:40 -080052
53# Directly access external storage
54neverallow ephemeral_app { sdcard_type media_rw_data_file }:file {open create};
55neverallow ephemeral_app { sdcard_type media_rw_data_file }:dir search;