blob: 92890273ade1711973c99d68a96939c9fd45d12d [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
Alex Klyubinf5446eb2017-03-23 14:27:32 -070014typeattribute ephemeral_app coredomain;
15
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080016net_domain(ephemeral_app)
Chad Brubaker5c566d12017-01-17 13:28:24 -080017app_domain(ephemeral_app)
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080018
Chad Brubaker3d348fd2017-01-19 10:42:40 -080019# Allow ephemeral apps to read/write files in visible storage if provided fds
20allow ephemeral_app { sdcard_type media_rw_data_file }:file {read write getattr ioctl lock append};
21
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080022# services
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080023allow ephemeral_app surfaceflinger_service:service_manager find;
Chad Brubaker5c566d12017-01-17 13:28:24 -080024allow ephemeral_app radio_service:service_manager find;
Alex Klyubin6237d8b2017-02-28 13:59:06 -080025allow ephemeral_app ephemeral_app_api_service:service_manager find;
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080026
27###
28### neverallow rules
29###
30
31# Executable content should never be loaded from an ephemeral app home directory.
Chad Brubaker4c40d732017-01-25 14:55:56 -080032neverallow ephemeral_app app_data_file:file { execute execute_no_trans };
Alex Klyubinbaeac1f2017-01-09 15:34:27 -080033
34# Receive or send uevent messages.
35neverallow ephemeral_app domain:netlink_kobject_uevent_socket *;
36
37# Receive or send generic netlink messages
38neverallow ephemeral_app domain:netlink_socket *;
39
40# Too much leaky information in debugfs. It's a security
41# best practice to ensure these files aren't readable.
42neverallow ephemeral_app debugfs:file read;
43
44# execute gpu_device
45neverallow ephemeral_app gpu_device:chr_file execute;
46
47# access files in /sys with the default sysfs label
48neverallow ephemeral_app sysfs:file *;
49
50# Avoid reads from generically labeled /proc files
51# Create a more specific label if needed
52neverallow ephemeral_app proc:file { no_rw_file_perms no_x_file_perms };
Chad Brubaker3d348fd2017-01-19 10:42:40 -080053
54# Directly access external storage
55neverallow ephemeral_app { sdcard_type media_rw_data_file }:file {open create};
56neverallow ephemeral_app { sdcard_type media_rw_data_file }:dir search;
Chad Brubakerc4a938e2017-03-15 14:26:18 -070057
58# Avoid reads to proc_net, it contains too much device wide information about
59# ongoing connections.
60neverallow ephemeral_app proc_net:file no_rw_file_perms;