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