blob: b18b7dda30855615117741c3c60c99863e37f69f [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
6type sdk_sandbox, domain;
7
8typeattribute sdk_sandbox coredomain;
9
10net_domain(sdk_sandbox)
11app_domain(sdk_sandbox)
12
13# Allow finding services. This is different from ephemeral_app policy.
14# Adding services manually to the allowlist is preferred hence app_api_service is not used.
15allow sdk_sandbox activity_service:service_manager find;
16allow sdk_sandbox activity_task_service:service_manager find;
17allow sdk_sandbox audio_service:service_manager find;
18# Audit the access to signal that we are still investigating whether sdk_sandbox
19# should have access to audio_service
20# TODO(b/211632068): remove this line
21auditallow sdk_sandbox audio_service:service_manager find;
22allow sdk_sandbox hint_service:service_manager find;
23allow sdk_sandbox surfaceflinger_service:service_manager find;
Shiwangi Shah155d3182022-03-24 12:52:32 +000024allow sdk_sandbox thermal_service:service_manager find;
Bram Bonneb93f26f2022-03-15 18:28:02 +010025allow sdk_sandbox trust_service:service_manager find;
26allow sdk_sandbox uimode_service:service_manager find;
27allow sdk_sandbox webviewupdate_service:service_manager find;
28
29# Write app-specific trace data to the Perfetto traced damon. This requires
30# connecting to its producer socket and obtaining a (per-process) tmpfs fd.
31perfetto_producer(sdk_sandbox)
32
33# Allow profiling if the app opts in by being marked profileable/debuggable.
34can_profile_heap(sdk_sandbox)
35can_profile_perf(sdk_sandbox)
36
37# allow sdk sandbox to use UDP sockets provided by the system server but not
38# modify them other than to connect
39allow sdk_sandbox system_server:udp_socket {
40 connect getattr read recvfrom sendto write getopt setopt };
41
42# allow access to sdksandbox data directory
43allow sdk_sandbox sdk_sandbox_data_file:dir create_dir_perms;
44allow sdk_sandbox sdk_sandbox_data_file:file create_file_perms;
45
46###
47### neverallow rules
48###
49
50neverallow sdk_sandbox { app_data_file privapp_data_file }:file { execute execute_no_trans };
51
52# Receive or send uevent messages.
53neverallow sdk_sandbox domain:netlink_kobject_uevent_socket *;
54
55# Receive or send generic netlink messages
56neverallow sdk_sandbox domain:netlink_socket *;
57
58# Too much leaky information in debugfs. It's a security
59# best practice to ensure these files aren't readable.
60neverallow sdk_sandbox debugfs:file read;
61
62# execute gpu_device
63neverallow sdk_sandbox gpu_device:chr_file execute;
64
65# access files in /sys with the default sysfs label
66neverallow sdk_sandbox sysfs:file *;
67
68# Avoid reads from generically labeled /proc files
69# Create a more specific label if needed
70neverallow sdk_sandbox proc:file { no_rw_file_perms no_x_file_perms };
71
72# Directly access external storage
73neverallow sdk_sandbox { sdcard_type media_rw_data_file }:file {open create};
74neverallow sdk_sandbox { sdcard_type media_rw_data_file }:dir search;
75
76# Avoid reads to proc_net, it contains too much device wide information about
77# ongoing connections.
78neverallow sdk_sandbox proc_net:file no_rw_file_perms;
79
80# SDK sandbox processes have their own storage not related to app_data_file or privapp_data_file
81neverallow sdk_sandbox { app_data_file privapp_data_file }:dir no_rw_file_perms;
82neverallow sdk_sandbox { app_data_file privapp_data_file }:file no_rw_file_perms;
83
84# SDK sandbox processes don't have any access to external storage
85neverallow sdk_sandbox { media_rw_data_file }:dir no_rw_file_perms;
86neverallow sdk_sandbox { media_rw_data_file }:file no_rw_file_perms;
87
88neverallow { sdk_sandbox } tmpfs:dir no_rw_file_perms;
Bram Bonne85dfe312022-03-23 17:48:48 +010089
90neverallow sdk_sandbox hal_drm_service:service_manager find;