blob: f98b1d1cd034cd43e2069cb35211c0bc9234d0de [file] [log] [blame]
Alex Klyubina3903972017-01-05 16:06:54 -08001###
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
dcashman3e8dbf02016-12-08 11:23:34 -08009app_domain(isolated_app)
dcashman2e00e632016-10-12 14:58:09 -070010
Alex Klyubina3903972017-01-05 16:06:54 -080011# Access already open app data files received over Binder or local socket IPC.
12allow isolated_app app_data_file:file { append read write getattr lock };
13
14allow isolated_app activity_service:service_manager find;
15allow isolated_app display_service:service_manager find;
16allow isolated_app webviewupdate_service:service_manager find;
17
18# Google Breakpad (crash reporter for Chrome) relies on ptrace
19# functionality. Without the ability to ptrace, the crash reporter
20# tool is broken.
21# b/20150694
22# https://code.google.com/p/chromium/issues/detail?id=475270
23allow isolated_app self:process ptrace;
24
25# b/32896414: Allow accessing sdcard file descriptors passed to isolated_apps
26# by other processes. Open should never be allowed, and is blocked by
27# neverallow rules below.
28# TODO: consider removing write/append. We want to limit isolated_apps
29# ability to mutate files of any type.
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.
32allow isolated_app { sdcard_type media_rw_data_file }:file { read write append getattr lock };
33auditallow isolated_app { sdcard_type media_rw_data_file }:file { write append };
34
35# For webviews, isolated_app processes can be forked from the webview_zygote
36# in addition to the zygote. Allow access to resources inherited from the
37# webview_zygote process. These rules are specialized copies of the ones in app.te.
38# Inherit FDs from the webview_zygote.
39allow isolated_app webview_zygote:fd use;
40# Notify webview_zygote of child death.
41allow isolated_app webview_zygote:process sigchld;
42# Inherit logd write socket.
43allow isolated_app webview_zygote:unix_dgram_socket write;
dcashman2e00e632016-10-12 14:58:09 -070044# Read system properties managed by webview_zygote.
45allow isolated_app webview_zygote_tmpfs:file read;
Alex Klyubina3903972017-01-05 16:06:54 -080046
47#####
48##### Neverallow
49#####
50
51# Do not allow isolated_app to directly open tun_device
52neverallow isolated_app tun_device:chr_file open;
53
Alex Klyubina3903972017-01-05 16:06:54 -080054# Isolated apps should not directly open app data files themselves.
55neverallow isolated_app app_data_file:file open;
56
57# Only allow appending to /data/anr/traces.txt (b/27853304, b/18340553)
58# TODO: are there situations where isolated_apps write to this file?
59# TODO: should we tighten these restrictions further?
60neverallow isolated_app anr_data_file:file ~{ open append };
61neverallow isolated_app anr_data_file:dir ~search;
62
63# b/17487348
64# Isolated apps can only access three services,
65# activity_service, display_service and webviewupdate_service.
66neverallow isolated_app {
67 service_manager_type
68 -activity_service
69 -display_service
70 -webviewupdate_service
71}:service_manager find;
72
73# Isolated apps shouldn't be able to access the driver directly.
74neverallow isolated_app gpu_device:chr_file { rw_file_perms execute };
75
76# Do not allow isolated_app access to /cache
77neverallow isolated_app cache_file:dir ~{ r_dir_perms };
78neverallow isolated_app cache_file:file ~{ read getattr };
79
Alex Klyubina3903972017-01-05 16:06:54 -080080# Do not allow isolated_app to access external storage, except for files passed
81# via file descriptors (b/32896414).
82neverallow isolated_app { storage_file mnt_user_file sdcard_type }:dir ~getattr;
83neverallow isolated_app { storage_file mnt_user_file }:file_class_set *;
84neverallow isolated_app sdcard_type:{ devfile_class_set lnk_file sock_file fifo_file } *;
85neverallow isolated_app sdcard_type:file ~{ read write append getattr lock };
86
87# Do not allow USB access
88neverallow isolated_app { usb_device usbaccessory_device }:chr_file *;
89
90# Restrict the webview_zygote control socket.
91neverallow isolated_app webview_zygote_socket:sock_file write;