Alex Klyubin | a390397 | 2017-01-05 16:06:54 -0800 | [diff] [blame] | 1 | ### |
| 2 | ### Services with isolatedProcess=true in their manifest. |
| 3 | ### |
| 4 | ### This file defines the rules for isolated apps. An "isolated |
| 5 | ### app" is an APP with UID between AID_ISOLATED_START (99000) |
| 6 | ### and AID_ISOLATED_END (99999). |
| 7 | ### |
| 8 | |
Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 9 | typeattribute isolated_app coredomain; |
| 10 | |
dcashman | 3e8dbf0 | 2016-12-08 11:23:34 -0800 | [diff] [blame] | 11 | app_domain(isolated_app) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 12 | |
Alex Klyubin | a390397 | 2017-01-05 16:06:54 -0800 | [diff] [blame] | 13 | # Access already open app data files received over Binder or local socket IPC. |
| 14 | allow isolated_app app_data_file:file { append read write getattr lock }; |
| 15 | |
| 16 | allow isolated_app activity_service:service_manager find; |
| 17 | allow isolated_app display_service:service_manager find; |
| 18 | allow isolated_app webviewupdate_service:service_manager find; |
| 19 | |
| 20 | # Google Breakpad (crash reporter for Chrome) relies on ptrace |
| 21 | # functionality. Without the ability to ptrace, the crash reporter |
| 22 | # tool is broken. |
| 23 | # b/20150694 |
| 24 | # https://code.google.com/p/chromium/issues/detail?id=475270 |
| 25 | allow isolated_app self:process ptrace; |
| 26 | |
| 27 | # b/32896414: Allow accessing sdcard file descriptors passed to isolated_apps |
| 28 | # by other processes. Open should never be allowed, and is blocked by |
| 29 | # neverallow rules below. |
Alex Klyubin | a390397 | 2017-01-05 16:06:54 -0800 | [diff] [blame] | 30 | # media_rw_data_file is included for sdcardfs, and can be removed if sdcardfs |
| 31 | # is modified to change the secontext when accessing the lower filesystem. |
| 32 | allow isolated_app { sdcard_type media_rw_data_file }:file { read write append getattr lock }; |
Alex Klyubin | a390397 | 2017-01-05 16:06:54 -0800 | [diff] [blame] | 33 | |
| 34 | # For webviews, isolated_app processes can be forked from the webview_zygote |
| 35 | # in addition to the zygote. Allow access to resources inherited from the |
| 36 | # webview_zygote process. These rules are specialized copies of the ones in app.te. |
| 37 | # Inherit FDs from the webview_zygote. |
| 38 | allow isolated_app webview_zygote:fd use; |
| 39 | # Notify webview_zygote of child death. |
| 40 | allow isolated_app webview_zygote:process sigchld; |
| 41 | # Inherit logd write socket. |
| 42 | allow isolated_app webview_zygote:unix_dgram_socket write; |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 43 | # Read system properties managed by webview_zygote. |
| 44 | allow isolated_app webview_zygote_tmpfs:file read; |
Alex Klyubin | a390397 | 2017-01-05 16:06:54 -0800 | [diff] [blame] | 45 | |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 46 | # TODO (b/63631799) fix this access |
| 47 | # suppress denials to /data/local/tmp |
| 48 | dontaudit isolated_app shell_data_file:dir search; |
| 49 | |
Alex Klyubin | a390397 | 2017-01-05 16:06:54 -0800 | [diff] [blame] | 50 | ##### |
| 51 | ##### Neverallow |
| 52 | ##### |
| 53 | |
| 54 | # Do not allow isolated_app to directly open tun_device |
| 55 | neverallow isolated_app tun_device:chr_file open; |
| 56 | |
Alex Klyubin | a390397 | 2017-01-05 16:06:54 -0800 | [diff] [blame] | 57 | # Isolated apps should not directly open app data files themselves. |
| 58 | neverallow isolated_app app_data_file:file open; |
| 59 | |
| 60 | # Only allow appending to /data/anr/traces.txt (b/27853304, b/18340553) |
| 61 | # TODO: are there situations where isolated_apps write to this file? |
| 62 | # TODO: should we tighten these restrictions further? |
| 63 | neverallow isolated_app anr_data_file:file ~{ open append }; |
| 64 | neverallow isolated_app anr_data_file:dir ~search; |
| 65 | |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 66 | # Isolated apps must not be permitted to use HwBinder |
| 67 | neverallow isolated_app hwbinder_device:chr_file *; |
| 68 | neverallow isolated_app *:hwservice_manager *; |
| 69 | |
| 70 | # Isolated apps must not be permitted to use VndBinder |
| 71 | neverallow isolated_app vndbinder_device:chr_file *; |
| 72 | |
| 73 | # Isolated apps must not be permitted to perform actions on Binder and VndBinder service_manager |
| 74 | # except the find actions for services whitelisted below. |
| 75 | neverallow isolated_app *:service_manager ~find; |
| 76 | |
Alex Klyubin | a390397 | 2017-01-05 16:06:54 -0800 | [diff] [blame] | 77 | # b/17487348 |
| 78 | # Isolated apps can only access three services, |
| 79 | # activity_service, display_service and webviewupdate_service. |
| 80 | neverallow isolated_app { |
| 81 | service_manager_type |
| 82 | -activity_service |
| 83 | -display_service |
| 84 | -webviewupdate_service |
| 85 | }:service_manager find; |
| 86 | |
| 87 | # Isolated apps shouldn't be able to access the driver directly. |
| 88 | neverallow isolated_app gpu_device:chr_file { rw_file_perms execute }; |
| 89 | |
| 90 | # Do not allow isolated_app access to /cache |
| 91 | neverallow isolated_app cache_file:dir ~{ r_dir_perms }; |
| 92 | neverallow isolated_app cache_file:file ~{ read getattr }; |
| 93 | |
Alex Klyubin | a390397 | 2017-01-05 16:06:54 -0800 | [diff] [blame] | 94 | # Do not allow isolated_app to access external storage, except for files passed |
| 95 | # via file descriptors (b/32896414). |
| 96 | neverallow isolated_app { storage_file mnt_user_file sdcard_type }:dir ~getattr; |
| 97 | neverallow isolated_app { storage_file mnt_user_file }:file_class_set *; |
| 98 | neverallow isolated_app sdcard_type:{ devfile_class_set lnk_file sock_file fifo_file } *; |
| 99 | neverallow isolated_app sdcard_type:file ~{ read write append getattr lock }; |
| 100 | |
| 101 | # Do not allow USB access |
| 102 | neverallow isolated_app { usb_device usbaccessory_device }:chr_file *; |
| 103 | |
| 104 | # Restrict the webview_zygote control socket. |
| 105 | neverallow isolated_app webview_zygote_socket:sock_file write; |