• 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# Allow access to temporary files, which is normally permitted through
10# a domain macro.
11tmpfs_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:global_capability_class_set { setgid setuid };
24# Drop capabilities from bounding set.
25allow webview_zygote self:global_capability_class_set 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# TODO (b/63631799) fix this access
47# Suppress denials to storage. Webview zygote should not be accessing.
48dontaudit webview_zygote mnt_expand_file:dir getattr;
49
50# TODO (b/72957399) remove this when webview_zygote is reparented to
51# app_process zygote
52dontaudit webview_zygote dex2oat_exec:file execute;
53
54# Get seapp_contexts
55allow webview_zygote seapp_contexts_file:file r_file_perms;
56# Check validity of SELinux context before use.
57selinux_check_context(webview_zygote)
58# Check SELinux permissions.
59selinux_check_access(webview_zygote)
60
61# Directory listing in /system.
62allow webview_zygote system_file:dir r_dir_perms;
63
64# Read system properties managed by zygote.
65allow webview_zygote zygote_tmpfs:file read;
66# Child of zygote.
67allow webview_zygote zygote:fd use;
68allow webview_zygote zygote:process sigchld;
69
70# Allow apps access to /vendor/overlay
71r_dir_file(webview_zygote, vendor_overlay_file)
72
73#####
74##### Neverallow
75#####
76
77# Only permit transition to isolated_app.
78neverallow webview_zygote { domain -isolated_app }:process dyntransition;
79
80# Only setcon() transitions, no exec() based transitions, except for crash_dump.
81neverallow webview_zygote { domain -crash_dump }:process transition;
82
83# Must not exec() a program without changing domains.
84# Having said that, exec() above is not allowed.
85neverallow webview_zygote *:file execute_no_trans;
86
87# The only way to enter this domain is for the zygote to fork a new
88# webview_zygote child.
89neverallow { domain -zygote } webview_zygote:process dyntransition;
90
91# Disallow write access to properties.
92neverallow webview_zygote property_socket:sock_file write;
93neverallow webview_zygote property_type:property_service set;
94
95# Should not have any access to app data files.
96neverallow webview_zygote {
97    app_data_file
98    system_app_data_file
99    bluetooth_data_file
100    nfc_data_file
101    radio_data_file
102    shell_data_file
103}:file { rwx_file_perms };
104
105neverallow webview_zygote {
106    service_manager_type
107    -activity_service
108    -webviewupdate_service
109}:service_manager find;
110
111# Isolated apps shouldn't be able to access the driver directly.
112neverallow webview_zygote gpu_device:chr_file { rwx_file_perms };
113
114# Do not allow webview_zygote access to /cache.
115neverallow webview_zygote cache_file:dir ~{ r_dir_perms };
116neverallow webview_zygote cache_file:file ~{ read getattr };
117
118# Do not allow most socket access. This is socket_class_set, excluding unix_dgram_socket,
119# unix_stream_socket, and netlink_selinux_socket.
120neverallow webview_zygote domain:{
121  socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket
122  appletalk_socket netlink_route_socket netlink_tcpdiag_socket
123  netlink_nflog_socket netlink_xfrm_socket netlink_audit_socket
124  netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket netlink_iscsi_socket
125  netlink_fib_lookup_socket netlink_connector_socket netlink_netfilter_socket
126  netlink_generic_socket netlink_scsitransport_socket netlink_rdma_socket netlink_crypto_socket
127  sctp_socket icmp_socket ax25_socket ipx_socket netrom_socket atmpvc_socket
128  x25_socket rose_socket decnet_socket atmsvc_socket rds_socket irda_socket
129  pppox_socket llc_socket can_socket tipc_socket bluetooth_socket iucv_socket
130  rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket
131  alg_socket nfc_socket vsock_socket kcm_socket qipcrtr_socket smc_socket
132} *;
133
134# Do not allow access to Bluetooth-related system properties.
135# neverallow rules for Bluetooth-related data files are listed above.
136neverallow webview_zygote {
137  bluetooth_a2dp_offload_prop
138  bluetooth_prop
139  exported_bluetooth_prop
140}:file create_file_perms;
141