• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# webview_zygote is an auxiliary zygote process that is used to spawn
2# isolated_app processes for rendering untrusted web content.
3
4typeattribute webview_zygote coredomain;
5
6# The webview_zygote needs to be able to transition domains.
7typeattribute webview_zygote mlstrustedsubject;
8
9# When init launches the WebView zygote's executable, transition the
10# resulting process into webview_zygote domain.
11init_daemon_domain(webview_zygote)
12
13# Allow reading/executing installed binaries to enable preloading the
14# installed WebView implementation.
15allow webview_zygote apk_data_file:dir r_dir_perms;
16allow webview_zygote apk_data_file:file { r_file_perms execute };
17
18# Access to the WebView relro file.
19allow webview_zygote shared_relro_file:dir search;
20allow webview_zygote shared_relro_file:file r_file_perms;
21
22# Set the UID/GID of the process.
23allow webview_zygote self:capability { setgid setuid };
24# Drop capabilities from bounding set.
25allow webview_zygote self:capability setpcap;
26# Switch SELinux context to app domains.
27allow webview_zygote self:process setcurrent;
28allow webview_zygote isolated_app:process dyntransition;
29
30# For art.
31allow webview_zygote dalvikcache_data_file:dir r_dir_perms;
32allow webview_zygote dalvikcache_data_file:lnk_file r_file_perms;
33allow webview_zygote dalvikcache_data_file:file { r_file_perms execute };
34
35# Allow webview_zygote to stat the files that it opens. It must
36# be able to inspect them so that it can reopen them on fork
37# if necessary: b/30963384.
38allow webview_zygote debugfs_trace_marker:file getattr;
39
40# Allow webview_zygote to manage the pgroup of its children.
41allow webview_zygote system_server:process getpgid;
42
43# Interaction between the webview_zygote and its children.
44allow webview_zygote isolated_app:process setpgid;
45
46# Get seapp_contexts
47allow webview_zygote seapp_contexts_file:file r_file_perms;
48# Check validity of SELinux context before use.
49selinux_check_context(webview_zygote)
50# Check SELinux permissions.
51selinux_check_access(webview_zygote)
52
53#####
54##### Neverallow
55#####
56
57# Only permit transition to isolated_app.
58neverallow webview_zygote { domain -isolated_app }:process dyntransition;
59
60# Only setcon() transitions, no exec() based transitions, except for crash_dump.
61neverallow webview_zygote { domain -crash_dump }:process transition;
62
63# Must not exec() a program without changing domains.
64# Having said that, exec() above is not allowed.
65neverallow webview_zygote *:file execute_no_trans;
66
67# The only way to enter this domain is for init to exec() us.
68neverallow { domain -init } webview_zygote:process transition;
69neverallow * webview_zygote:process dyntransition;
70
71# Disallow write access to properties.
72neverallow webview_zygote property_socket:sock_file write;
73neverallow webview_zygote property_type:property_service set;
74
75# Should not have any access to app data files.
76neverallow webview_zygote {
77    app_data_file
78    system_app_data_file
79    bluetooth_data_file
80    nfc_data_file
81    radio_data_file
82    shell_data_file
83}:file { rwx_file_perms };
84
85neverallow webview_zygote {
86    service_manager_type
87    -activity_service
88    -webviewupdate_service
89}:service_manager find;
90
91# Isolated apps shouldn't be able to access the driver directly.
92neverallow webview_zygote gpu_device:chr_file { rwx_file_perms };
93
94# Do not allow webview_zygote access to /cache.
95neverallow webview_zygote cache_file:dir ~{ r_dir_perms };
96neverallow webview_zygote cache_file:file ~{ read getattr };
97
98# Do not allow most socket access. This is socket_class_set, excluding unix_dgram_socket,
99# unix_stream_socket, and netlink_selinux_socket.
100neverallow webview_zygote domain:{
101  socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket
102  appletalk_socket netlink_route_socket netlink_tcpdiag_socket
103  netlink_nflog_socket netlink_xfrm_socket netlink_audit_socket
104  netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket netlink_iscsi_socket
105  netlink_fib_lookup_socket netlink_connector_socket netlink_netfilter_socket
106  netlink_generic_socket netlink_scsitransport_socket netlink_rdma_socket netlink_crypto_socket
107  sctp_socket icmp_socket ax25_socket ipx_socket netrom_socket atmpvc_socket
108  x25_socket rose_socket decnet_socket atmsvc_socket rds_socket irda_socket
109  pppox_socket llc_socket can_socket tipc_socket bluetooth_socket iucv_socket
110  rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket
111  alg_socket nfc_socket vsock_socket kcm_socket qipcrtr_socket
112} *;
113
114# Do not allow access to Bluetooth-related system properties.
115# neverallow rules for Bluetooth-related data files are listed above.
116neverallow webview_zygote bluetooth_prop:file create_file_perms;
117