2017-01-10 00:34:27 +01:00
|
|
|
###
|
|
|
|
### Ephemeral apps.
|
|
|
|
###
|
|
|
|
### This file defines the security policy for apps with the ephemeral
|
|
|
|
### feature.
|
|
|
|
###
|
|
|
|
### The ephemeral_app domain is a reduced permissions sandbox allowing
|
|
|
|
### ephemeral applications to be safely installed and run. Non ephemeral
|
|
|
|
### applications may also opt-in to ephemeral to take advantage of the
|
|
|
|
### additional security features.
|
|
|
|
###
|
|
|
|
### PackageManager flags an app as ephemeral at install time.
|
|
|
|
|
|
|
|
net_domain(ephemeral_app)
|
2017-01-17 22:28:24 +01:00
|
|
|
app_domain(ephemeral_app)
|
2017-01-10 00:34:27 +01:00
|
|
|
|
2017-01-19 19:42:40 +01:00
|
|
|
# Allow ephemeral apps to read/write files in visible storage if provided fds
|
|
|
|
allow ephemeral_app { sdcard_type media_rw_data_file }:file {read write getattr ioctl lock append};
|
|
|
|
|
2017-01-10 00:34:27 +01:00
|
|
|
# services
|
|
|
|
allow ephemeral_app surfaceflinger_service:service_manager find;
|
2017-01-17 22:28:24 +01:00
|
|
|
allow ephemeral_app radio_service:service_manager find;
|
|
|
|
# TODO: Replace app_api_service with a smaller ephemeral_api_service
|
|
|
|
allow ephemeral_app app_api_service:service_manager find;
|
2017-01-10 00:34:27 +01:00
|
|
|
|
|
|
|
###
|
|
|
|
### neverallow rules
|
|
|
|
###
|
|
|
|
|
|
|
|
# Executable content should never be loaded from an ephemeral app home directory.
|
2017-01-25 23:55:56 +01:00
|
|
|
neverallow ephemeral_app app_data_file:file { execute execute_no_trans };
|
2017-01-10 00:34:27 +01:00
|
|
|
|
|
|
|
# Receive or send uevent messages.
|
|
|
|
neverallow ephemeral_app domain:netlink_kobject_uevent_socket *;
|
|
|
|
|
|
|
|
# Receive or send generic netlink messages
|
|
|
|
neverallow ephemeral_app domain:netlink_socket *;
|
|
|
|
|
|
|
|
# Too much leaky information in debugfs. It's a security
|
|
|
|
# best practice to ensure these files aren't readable.
|
|
|
|
neverallow ephemeral_app debugfs:file read;
|
|
|
|
|
|
|
|
# execute gpu_device
|
|
|
|
neverallow ephemeral_app gpu_device:chr_file execute;
|
|
|
|
|
|
|
|
# access files in /sys with the default sysfs label
|
|
|
|
neverallow ephemeral_app sysfs:file *;
|
|
|
|
|
|
|
|
# Avoid reads from generically labeled /proc files
|
|
|
|
# Create a more specific label if needed
|
|
|
|
neverallow ephemeral_app proc:file { no_rw_file_perms no_x_file_perms };
|
2017-01-19 19:42:40 +01:00
|
|
|
|
|
|
|
# Directly access external storage
|
|
|
|
neverallow ephemeral_app { sdcard_type media_rw_data_file }:file {open create};
|
|
|
|
neverallow ephemeral_app { sdcard_type media_rw_data_file }:dir search;
|