Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 1 | # The entries in this file define how security contexts for apps are determined. |
| 2 | # Each entry lists input selectors, used to match the app, and outputs which are |
| 3 | # used to determine the security contexts for matching apps. |
| 4 | # |
Nick Kralevich | 4be3190 | 2014-07-01 13:59:50 -0700 | [diff] [blame] | 5 | # Input selectors: |
Michael Peck | f54b362 | 2017-02-14 09:48:57 -0800 | [diff] [blame] | 6 | # isSystemServer (boolean) |
| 7 | # isEphemeralApp (boolean) |
Michael Peck | f54b362 | 2017-02-14 09:48:57 -0800 | [diff] [blame] | 8 | # user (string) |
| 9 | # seinfo (string) |
| 10 | # name (string) |
Michael Peck | f54b362 | 2017-02-14 09:48:57 -0800 | [diff] [blame] | 11 | # isPrivApp (boolean) |
| 12 | # minTargetSdkVersion (unsigned integer) |
Yabin Cui | ffa2b61 | 2018-11-02 14:34:06 -0700 | [diff] [blame] | 13 | # fromRunAs (boolean) |
Charles Chen | 3070492 | 2023-01-15 05:41:42 +0000 | [diff] [blame] | 14 | # isIsolatedComputeApp (boolean) |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 15 | # |
| 16 | # All specified input selectors in an entry must match (i.e. logical AND). |
| 17 | # An unspecified string or boolean selector with no default will match any |
| 18 | # value. |
Jeff Vander Stoep | 35779f0 | 2021-07-01 10:28:37 +0200 | [diff] [blame] | 19 | # A user, or name string selector that ends in * will perform a prefix |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 20 | # match. |
| 21 | # String matching is case-insensitive. |
| 22 | # See external/selinux/libselinux/src/android/android_platform.c, |
| 23 | # seapp_context_lookup(). |
| 24 | # |
| 25 | # isSystemServer=true only matches the system server. |
Stephen Smalley | dd31ddf | 2012-07-27 17:08:21 -0400 | [diff] [blame] | 26 | # An unspecified isSystemServer defaults to false. |
Chad Brubaker | 06cf31e | 2016-10-06 13:15:44 -0700 | [diff] [blame] | 27 | # isEphemeralApp=true will match apps marked by PackageManager as Ephemeral |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 28 | # user=_app will match any regular app process. |
| 29 | # user=_isolated will match any isolated service process. |
Nikita Ioffe | e2da633 | 2022-02-21 17:55:59 +0000 | [diff] [blame] | 30 | # user=_sdksandbox will match sdk sandbox process for an app. |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 31 | # Other values of user are matched against the name associated with the process |
| 32 | # UID. |
| 33 | # seinfo= matches aginst the seinfo tag for the app, determined from |
| 34 | # mac_permissions.xml files. |
| 35 | # The ':' character is reserved and may not be used in seinfo. |
| 36 | # name= matches against the package name of the app. |
Jeff Vander Stoep | ee9c0b5 | 2015-10-05 09:15:04 -0700 | [diff] [blame] | 37 | # isPrivApp=true will only match for applications preinstalled in |
| 38 | # /system/priv-app. |
Michael Peck | f54b362 | 2017-02-14 09:48:57 -0800 | [diff] [blame] | 39 | # minTargetSdkVersion will match applications with a targetSdkVersion |
| 40 | # greater than or equal to the specified value. If unspecified, |
| 41 | # it has a default value of 0. |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 42 | # fromRunAs=true means the process being labeled is started by run-as. Default |
| 43 | # is false. |
Charles Chen | 3070492 | 2023-01-15 05:41:42 +0000 | [diff] [blame] | 44 | # isIsolatedComputeApp=true means the process re-uses an isolated Uid but not |
| 45 | # restricted to run in an isolated_app domain. Processes match this selector will |
| 46 | # be mapped to isolated_compute_app by default. It is expected to be used together |
| 47 | # with user=_isolated. This selector should not be used unless it is intended |
| 48 | # to provide isolated processes with relaxed security restrictions. |
Nick Kralevich | 4be3190 | 2014-07-01 13:59:50 -0700 | [diff] [blame] | 49 | # |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 50 | # Precedence: entries are compared using the following rules, in the order shown |
| 51 | # (see external/selinux/libselinux/src/android/android_platform.c, |
| 52 | # seapp_context_cmp()). |
Michael Peck | f54b362 | 2017-02-14 09:48:57 -0800 | [diff] [blame] | 53 | # (1) isSystemServer=true before isSystemServer=false. |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 54 | # (2) Specified isEphemeralApp= before unspecified isEphemeralApp= |
| 55 | # boolean. |
Jeff Vander Stoep | 35779f0 | 2021-07-01 10:28:37 +0200 | [diff] [blame] | 56 | # (3) Specified user= string before unspecified user= string; |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 57 | # more specific user= string before less specific user= string. |
Jeff Vander Stoep | 35779f0 | 2021-07-01 10:28:37 +0200 | [diff] [blame] | 58 | # (4) Specified seinfo= string before unspecified seinfo= string. |
| 59 | # (5) Specified name= string before unspecified name= string; |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 60 | # more specific name= string before less specific name= string. |
Jeff Vander Stoep | 35779f0 | 2021-07-01 10:28:37 +0200 | [diff] [blame] | 61 | # (6) Specified isPrivApp= before unspecified isPrivApp= boolean. |
| 62 | # (7) Higher value of minTargetSdkVersion= before lower value of |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 63 | # minTargetSdkVersion= integer. Note that minTargetSdkVersion= |
| 64 | # defaults to 0 if unspecified. |
Jeff Vander Stoep | 35779f0 | 2021-07-01 10:28:37 +0200 | [diff] [blame] | 65 | # (8) fromRunAs=true before fromRunAs=false. |
Charles Chen | 3070492 | 2023-01-15 05:41:42 +0000 | [diff] [blame] | 66 | # (9) isIsolatedComputeApp=true before isIsolatedComputeApp=false |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 67 | # (A fixed selector is more specific than a prefix, i.e. ending in *, and a |
| 68 | # longer prefix is more specific than a shorter prefix.) |
| 69 | # Apps are checked against entries in precedence order until the first match, |
| 70 | # regardless of their order in this file. |
| 71 | # |
| 72 | # Duplicate entries, i.e. with identical input selectors, are not allowed. |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 73 | # |
| 74 | # Outputs: |
Michael Peck | f54b362 | 2017-02-14 09:48:57 -0800 | [diff] [blame] | 75 | # domain (string) |
| 76 | # type (string) |
| 77 | # levelFrom (string; one of none, all, app, or user) |
| 78 | # level (string) |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 79 | # |
| 80 | # domain= determines the label to be used for the app process; entries |
| 81 | # without domain= are ignored for this purpose. |
| 82 | # type= specifies the label to be used for the app data directory; entries |
Alan Stokes | f8ad339 | 2020-10-27 17:35:33 +0000 | [diff] [blame] | 83 | # without type= are ignored for this purpose. The label specified must |
| 84 | # have the app_data_file_type attribute. |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 85 | # levelFrom and level are used to determine the level (sensitivity + categories) |
| 86 | # for MLS/MCS. |
| 87 | # levelFrom=none omits the level. |
| 88 | # levelFrom=app determines the level from the process UID. |
| 89 | # levelFrom=user determines the level from the user ID. |
| 90 | # levelFrom=all determines the level from both UID and user ID. |
Nick Kralevich | 795add5 | 2019-04-16 15:56:33 -0700 | [diff] [blame] | 91 | # |
Stephen Smalley | 3808414 | 2012-11-28 10:46:18 -0500 | [diff] [blame] | 92 | # levelFrom=user is only supported for _app or _isolated UIDs. |
| 93 | # levelFrom=app or levelFrom=all is only supported for _app UIDs. |
Nick Kralevich | 4be3190 | 2014-07-01 13:59:50 -0700 | [diff] [blame] | 94 | # level may be used to specify a fixed level for any UID. |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 95 | # |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 96 | # For backwards compatibility levelFromUid=true is equivalent to levelFrom=app |
| 97 | # and levelFromUid=false is equivalent to levelFrom=none. |
| 98 | # |
William Roberts | 81e1f90 | 2015-06-03 21:57:47 -0700 | [diff] [blame] | 99 | # |
| 100 | # Neverallow Assertions |
Alan Stokes | 6b576bd | 2019-01-31 15:16:01 +0000 | [diff] [blame] | 101 | # Additional compile time assertion checks for the rules in this file can be |
| 102 | # added as well. The assertion |
William Roberts | 81e1f90 | 2015-06-03 21:57:47 -0700 | [diff] [blame] | 103 | # rules are lines beginning with the keyword neverallow. Full support for PCRE |
| 104 | # regular expressions exists on all input and output selectors. Neverallow |
| 105 | # rules are never output to the built seapp_contexts file. Like all keywords, |
| 106 | # neverallows are case-insensitive. A neverallow is asserted when all key value |
| 107 | # inputs are matched on a key value rule line. |
| 108 | # |
| 109 | |
Alan Stokes | 665c295 | 2021-11-26 11:39:02 +0000 | [diff] [blame] | 110 | # only the system server can be assigned the system_server domains |
William Roberts | 81e1f90 | 2015-06-03 21:57:47 -0700 | [diff] [blame] | 111 | neverallow isSystemServer=false domain=system_server |
Alan Stokes | 665c295 | 2021-11-26 11:39:02 +0000 | [diff] [blame] | 112 | neverallow isSystemServer=false domain=system_server_startup |
William Roberts | 81e1f90 | 2015-06-03 21:57:47 -0700 | [diff] [blame] | 113 | neverallow isSystemServer="" domain=system_server |
Alan Stokes | 665c295 | 2021-11-26 11:39:02 +0000 | [diff] [blame] | 114 | neverallow isSystemServer="" domain=system_server_startup |
William Roberts | 81e1f90 | 2015-06-03 21:57:47 -0700 | [diff] [blame] | 115 | |
| 116 | # system domains should never be assigned outside of system uid |
| 117 | neverallow user=((?!system).)* domain=system_app |
| 118 | neverallow user=((?!system).)* type=system_app_data_file |
| 119 | |
Ashwini Oruganti | 04f771d | 2019-10-31 15:45:00 -0700 | [diff] [blame] | 120 | # any non priv-app with a non-known uid with a specified name should have a specified |
| 121 | # seinfo |
| 122 | neverallow user=_app isPrivApp=false name=.* seinfo="" |
| 123 | neverallow user=_app isPrivApp=false name=.* seinfo=default |
William Roberts | 81e1f90 | 2015-06-03 21:57:47 -0700 | [diff] [blame] | 124 | |
| 125 | # neverallow shared relro to any other domain |
| 126 | # and neverallow any other uid into shared_relro |
| 127 | neverallow user=shared_relro domain=((?!shared_relro).)* |
| 128 | neverallow user=((?!shared_relro).)* domain=shared_relro |
| 129 | |
| 130 | # neverallow non-isolated uids into isolated_app domain |
| 131 | # and vice versa |
Charles Chen | 3070492 | 2023-01-15 05:41:42 +0000 | [diff] [blame] | 132 | neverallow user=_isolated isIsolatedComputeApp=false domain=((?!isolated_app).)* |
William Roberts | 81e1f90 | 2015-06-03 21:57:47 -0700 | [diff] [blame] | 133 | neverallow user=((?!_isolated).)* domain=isolated_app |
| 134 | |
Charles Chen | 3070492 | 2023-01-15 05:41:42 +0000 | [diff] [blame] | 135 | # neverallow isolatedComputeApp into domains other than isolated_compute_app |
| 136 | neverallow user=_isolated isIsolatedComputeApp=true domain=((?!isolated_compute_app).)* |
| 137 | |
William Roberts | 81e1f90 | 2015-06-03 21:57:47 -0700 | [diff] [blame] | 138 | # uid shell should always be in shell domain, however non-shell |
| 139 | # uid's can be in shell domain |
| 140 | neverallow user=shell domain=((?!shell).)* |
| 141 | |
Max Bires | 77d41f7 | 2018-01-24 21:17:18 +0000 | [diff] [blame] | 142 | # only the package named com.android.shell can run in the shell domain |
| 143 | neverallow domain=shell name=((?!com\.android\.shell).)* |
| 144 | neverallow user=shell name=((?!com\.android\.shell).)* |
| 145 | |
Chad Brubaker | 06cf31e | 2016-10-06 13:15:44 -0700 | [diff] [blame] | 146 | # Ephemeral Apps must run in the ephemeral_app domain |
| 147 | neverallow isEphemeralApp=true domain=((?!ephemeral_app).)* |
Jeff Vander Stoep | 400d3ac | 2015-10-30 12:43:19 -0700 | [diff] [blame] | 148 | |
Nick Kralevich | caf42d6 | 2018-10-04 10:57:29 -0700 | [diff] [blame] | 149 | isSystemServer=true domain=system_server_startup |
| 150 | |
Nikita Ioffe | e2da633 | 2022-02-21 17:55:59 +0000 | [diff] [blame] | 151 | # sdksandbox must run in the sdksandbox domain |
| 152 | neverallow name=com.android.sdksandbox domain=((?!sdk_sandbox).)* |
RafayKamran | f3bdc0b | 2021-11-03 16:08:04 +0000 | [diff] [blame] | 153 | |
Kevin Jeon | 4241e00 | 2022-01-26 22:32:40 +0000 | [diff] [blame] | 154 | user=_app seinfo=platform name=com.android.traceur domain=traceur_app type=app_data_file levelFrom=all |
William Roberts | 92dfa31 | 2014-09-29 10:29:48 -0700 | [diff] [blame] | 155 | user=system seinfo=platform domain=system_app type=system_app_data_file |
Avichal Rakesh | e092924 | 2023-01-23 23:49:50 -0800 | [diff] [blame] | 156 | user=system seinfo=platform isPrivApp=true name=com.android.DeviceAsWebcam domain=device_as_webcam type=system_app_data_file levelFrom=all |
Roopa Sattiraju | f227d0d | 2022-03-28 14:39:42 -0700 | [diff] [blame] | 157 | user=bluetooth seinfo=bluetooth domain=bluetooth type=bluetooth_data_file |
markchien | 48c600f | 2020-11-26 09:55:56 +0800 | [diff] [blame] | 158 | user=network_stack seinfo=network_stack domain=network_stack type=radio_data_file |
William Roberts | 92dfa31 | 2014-09-29 10:29:48 -0700 | [diff] [blame] | 159 | user=nfc seinfo=platform domain=nfc type=nfc_data_file |
Ruchi Kandoi | 8a2b4a7 | 2018-01-04 10:33:20 -0800 | [diff] [blame] | 160 | user=secure_element seinfo=platform domain=secure_element levelFrom=all |
William Roberts | 92dfa31 | 2014-09-29 10:29:48 -0700 | [diff] [blame] | 161 | user=radio seinfo=platform domain=radio type=radio_data_file |
Alan Stokes | c7229c7 | 2020-09-24 13:46:46 +0100 | [diff] [blame] | 162 | user=shared_relro domain=shared_relro levelFrom=all |
Max Bires | 77d41f7 | 2018-01-24 21:17:18 +0000 | [diff] [blame] | 163 | user=shell seinfo=platform domain=shell name=com.android.shell type=shell_data_file |
Robert Sesek | bacb19b | 2018-01-30 10:54:33 -0500 | [diff] [blame] | 164 | user=webview_zygote seinfo=webview_zygote domain=webview_zygote |
Martijn Coenen | d40dfdc | 2020-06-08 20:31:33 +0200 | [diff] [blame] | 165 | user=_isolated domain=isolated_app levelFrom=user |
Charles Chen | bc965c9 | 2023-01-29 12:04:20 +0000 | [diff] [blame] | 166 | user=_isolated isIsolatedComputeApp=true domain=isolated_compute_app levelFrom=user |
Nikita Ioffe | e2da633 | 2022-02-21 17:55:59 +0000 | [diff] [blame] | 167 | user=_sdksandbox domain=sdk_sandbox type=sdk_sandbox_data_file levelFrom=all |
Martijn Coenen | d40dfdc | 2020-06-08 20:31:33 +0200 | [diff] [blame] | 168 | user=_app seinfo=app_zygote domain=app_zygote levelFrom=user |
Jeff Vander Stoep | fcf12fd | 2020-04-22 15:26:02 +0200 | [diff] [blame] | 169 | user=_app seinfo=media domain=mediaprovider type=app_data_file levelFrom=user |
Stephen Smalley | a833763 | 2014-09-11 14:07:28 -0400 | [diff] [blame] | 170 | user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user |
Nick Kralevich | 795add5 | 2019-04-16 15:56:33 -0700 | [diff] [blame] | 171 | user=_app isEphemeralApp=true domain=ephemeral_app type=app_data_file levelFrom=all |
Nick Kralevich | 5d17551 | 2018-09-12 12:30:32 -0700 | [diff] [blame] | 172 | user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user |
Ashwini Oruganti | 04f771d | 2019-10-31 15:45:00 -0700 | [diff] [blame] | 173 | user=_app isPrivApp=true name=com.google.android.permissioncontroller domain=permissioncontroller_app type=privapp_data_file levelFrom=all |
Jeff Vander Stoep | fcf12fd | 2020-04-22 15:26:02 +0200 | [diff] [blame] | 174 | user=_app seinfo=media isPrivApp=true name=com.android.providers.media.module domain=mediaprovider_app type=privapp_data_file levelFrom=all |
Krishang Garodia | caf7984 | 2023-02-09 17:31:47 +0000 | [diff] [blame] | 175 | user=_app seinfo=media isPrivApp=true name=com.android.providers.media.module:* domain=mediaprovider_app type=privapp_data_file levelFrom=all |
Martijn Coenen | e3f1d5a | 2020-01-30 16:52:45 +0100 | [diff] [blame] | 176 | user=_app isPrivApp=true name=com.google.android.providers.media.module domain=mediaprovider_app type=privapp_data_file levelFrom=all |
Krishang Garodia | caf7984 | 2023-02-09 17:31:47 +0000 | [diff] [blame] | 177 | user=_app isPrivApp=true name=com.google.android.providers.media.module:* domain=mediaprovider_app type=privapp_data_file levelFrom=all |
Ashwini Oruganti | b3bffe8 | 2020-06-15 11:14:04 -0700 | [diff] [blame] | 178 | user=_app seinfo=platform isPrivApp=true name=com.android.permissioncontroller domain=permissioncontroller_app type=privapp_data_file levelFrom=all |
Ashwini Oruganti | c77ff37 | 2019-11-14 14:00:30 -0800 | [diff] [blame] | 179 | user=_app isPrivApp=true name=com.android.vzwomatrigger domain=vzwomatrigger_app type=privapp_data_file levelFrom=all |
Seth Moore | 71fa94e | 2022-10-28 13:46:16 -0700 | [diff] [blame] | 180 | user=_app isPrivApp=true name=com.android.rkpdapp domain=rkpdapp type=privapp_data_file levelFrom=user |
Vikram Gaur | d7a1aaf | 2022-12-11 09:49:08 +0000 | [diff] [blame] | 181 | user=_app isPrivApp=true name=com.google.android.rkpdapp domain=rkpdapp type=privapp_data_file levelFrom=user |
Ashwini Oruganti | c46a7bc | 2019-10-29 14:13:20 -0700 | [diff] [blame] | 182 | user=_app isPrivApp=true name=com.google.android.gms domain=gmscore_app type=privapp_data_file levelFrom=user |
| 183 | user=_app isPrivApp=true name=com.google.android.gms.* domain=gmscore_app type=privapp_data_file levelFrom=user |
| 184 | user=_app isPrivApp=true name=com.google.android.gms:* domain=gmscore_app type=privapp_data_file levelFrom=user |
Ashwini Oruganti | efc3bdb | 2020-04-22 10:22:45 -0700 | [diff] [blame] | 185 | user=_app isPrivApp=true name=com.google.android.gsf domain=gmscore_app type=privapp_data_file levelFrom=user |
Yuyang Huang | cfdea5f | 2023-01-18 16:52:43 +0900 | [diff] [blame] | 186 | user=_app minTargetSdkVersion=34 domain=untrusted_app type=app_data_file levelFrom=all |
| 187 | user=_app minTargetSdkVersion=32 domain=untrusted_app_32 type=app_data_file levelFrom=all |
Bram Bonné | ea5460a | 2021-05-12 14:19:24 +0200 | [diff] [blame] | 188 | user=_app minTargetSdkVersion=30 domain=untrusted_app_30 type=app_data_file levelFrom=all |
Jeff Vander Stoep | 1f7ae8e | 2020-01-20 10:14:48 +0100 | [diff] [blame] | 189 | user=_app minTargetSdkVersion=29 domain=untrusted_app_29 type=app_data_file levelFrom=all |
Yabin Cui | 5dc2c8c | 2018-11-02 11:12:43 -0700 | [diff] [blame] | 190 | user=_app minTargetSdkVersion=28 domain=untrusted_app_27 type=app_data_file levelFrom=all |
Jeff Vander Stoep | 6231b4d | 2017-12-17 20:55:12 -0800 | [diff] [blame] | 191 | user=_app minTargetSdkVersion=26 domain=untrusted_app_27 type=app_data_file levelFrom=user |
Jeff Vander Stoep | bacb6d7 | 2017-02-13 13:33:27 -0800 | [diff] [blame] | 192 | user=_app domain=untrusted_app_25 type=app_data_file levelFrom=user |
Yabin Cui | 770a4f6 | 2019-01-07 16:37:24 -0800 | [diff] [blame] | 193 | user=_app minTargetSdkVersion=28 fromRunAs=true domain=runas_app levelFrom=all |
| 194 | user=_app fromRunAs=true domain=runas_app levelFrom=user |