blob: 1bb2c210874ce89867c19aee738cbfcb315e677c [file] [log] [blame]
Bram Bonneb93f26f2022-03-15 18:28:02 +01001###
2### SDK Sandbox process.
3###
4### This file defines the security policy for the sdk sandbox processes.
5
sandrome6971f12022-05-31 08:50:55 +00006type sdk_sandbox;
Bram Bonneb93f26f2022-03-15 18:28:02 +01007
8###
9### neverallow rules
10###
11
Bram Bonne078b43c2022-04-25 13:28:52 +020012neverallow sdk_sandbox { app_data_file privapp_data_file sdk_sandbox_data_file }:file { execute execute_no_trans };
Bram Bonneb93f26f2022-03-15 18:28:02 +010013
14# Receive or send uevent messages.
15neverallow sdk_sandbox domain:netlink_kobject_uevent_socket *;
16
17# Receive or send generic netlink messages
18neverallow sdk_sandbox domain:netlink_socket *;
19
20# Too much leaky information in debugfs. It's a security
21# best practice to ensure these files aren't readable.
22neverallow sdk_sandbox debugfs:file read;
23
24# execute gpu_device
25neverallow sdk_sandbox gpu_device:chr_file execute;
26
27# access files in /sys with the default sysfs label
28neverallow sdk_sandbox sysfs:file *;
29
30# Avoid reads from generically labeled /proc files
31# Create a more specific label if needed
32neverallow sdk_sandbox proc:file { no_rw_file_perms no_x_file_perms };
33
34# Directly access external storage
35neverallow sdk_sandbox { sdcard_type media_rw_data_file }:file {open create};
36neverallow sdk_sandbox { sdcard_type media_rw_data_file }:dir search;
37
38# Avoid reads to proc_net, it contains too much device wide information about
39# ongoing connections.
40neverallow sdk_sandbox proc_net:file no_rw_file_perms;
41
42# SDK sandbox processes have their own storage not related to app_data_file or privapp_data_file
43neverallow sdk_sandbox { app_data_file privapp_data_file }:dir no_rw_file_perms;
44neverallow sdk_sandbox { app_data_file privapp_data_file }:file no_rw_file_perms;
45
46# SDK sandbox processes don't have any access to external storage
47neverallow sdk_sandbox { media_rw_data_file }:dir no_rw_file_perms;
48neverallow sdk_sandbox { media_rw_data_file }:file no_rw_file_perms;
49
50neverallow { sdk_sandbox } tmpfs:dir no_rw_file_perms;
Bram Bonne85dfe312022-03-23 17:48:48 +010051
52neverallow sdk_sandbox hal_drm_service:service_manager find;
Mohammad Samiul Islamd2ffd352022-05-11 21:43:54 +010053
54# Only certain system components should have access to sdk_sandbox_system_data_file
55# sdk_sandbox only needs search. Restricted in follow up neverallow rule.
56neverallow {
57 domain
58 -init
59 -installd
Sanjana Sunil56301632022-05-20 11:24:32 +000060 -system_server
61 -vold_prepare_subdirs
62} sdk_sandbox_system_data_file:dir { relabelfrom };
63
64neverallow {
65 domain
66 -init
67 -installd
Mohammad Samiul Islamd2ffd352022-05-11 21:43:54 +010068 -sdk_sandbox
69 -system_server
70 -vold_prepare_subdirs
Sanjana Sunil56301632022-05-20 11:24:32 +000071 -zygote
72} sdk_sandbox_system_data_file:dir { create_dir_perms relabelto };
Mohammad Samiul Islamd2ffd352022-05-11 21:43:54 +010073
74# sdk_sandbox only needs to traverse through the sdk_sandbox_system_data_file
75neverallow sdk_sandbox sdk_sandbox_system_data_file:dir ~{ getattr search };
76
77# Only dirs should be created at sdk_sandbox_system_data_file level
78neverallow { domain -init } sdk_sandbox_system_data_file:file *;