blob: c7daf6b09979b9bf8233ac45b5b67a5fcc6d5555 [file] [log] [blame]
Alan Stokes6b576bd2019-01-31 15:16:01 +00001# 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 Kralevich4be31902014-07-01 13:59:50 -07005# Input selectors:
Michael Peckf54b3622017-02-14 09:48:57 -08006# isSystemServer (boolean)
7# isEphemeralApp (boolean)
Michael Peckf54b3622017-02-14 09:48:57 -08008# user (string)
9# seinfo (string)
10# name (string)
Michael Peckf54b3622017-02-14 09:48:57 -080011# isPrivApp (boolean)
12# minTargetSdkVersion (unsigned integer)
Yabin Cuiffa2b612018-11-02 14:34:06 -070013# fromRunAs (boolean)
Alan Stokes6b576bd2019-01-31 15:16:01 +000014#
15# All specified input selectors in an entry must match (i.e. logical AND).
16# An unspecified string or boolean selector with no default will match any
17# value.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020018# A user, or name string selector that ends in * will perform a prefix
Alan Stokes6b576bd2019-01-31 15:16:01 +000019# match.
20# String matching is case-insensitive.
21# See external/selinux/libselinux/src/android/android_platform.c,
22# seapp_context_lookup().
23#
24# isSystemServer=true only matches the system server.
Stephen Smalleydd31ddf2012-07-27 17:08:21 -040025# An unspecified isSystemServer defaults to false.
Chad Brubaker06cf31e2016-10-06 13:15:44 -070026# isEphemeralApp=true will match apps marked by PackageManager as Ephemeral
Alan Stokes6b576bd2019-01-31 15:16:01 +000027# user=_app will match any regular app process.
28# user=_isolated will match any isolated service process.
29# Other values of user are matched against the name associated with the process
30# UID.
31# seinfo= matches aginst the seinfo tag for the app, determined from
32# mac_permissions.xml files.
33# The ':' character is reserved and may not be used in seinfo.
34# name= matches against the package name of the app.
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -070035# isPrivApp=true will only match for applications preinstalled in
36# /system/priv-app.
Michael Peckf54b3622017-02-14 09:48:57 -080037# minTargetSdkVersion will match applications with a targetSdkVersion
38# greater than or equal to the specified value. If unspecified,
39# it has a default value of 0.
Alan Stokes6b576bd2019-01-31 15:16:01 +000040# fromRunAs=true means the process being labeled is started by run-as. Default
41# is false.
Nick Kralevich4be31902014-07-01 13:59:50 -070042#
Alan Stokes6b576bd2019-01-31 15:16:01 +000043# Precedence: entries are compared using the following rules, in the order shown
44# (see external/selinux/libselinux/src/android/android_platform.c,
45# seapp_context_cmp()).
Michael Peckf54b3622017-02-14 09:48:57 -080046# (1) isSystemServer=true before isSystemServer=false.
Alan Stokes6b576bd2019-01-31 15:16:01 +000047# (2) Specified isEphemeralApp= before unspecified isEphemeralApp=
48# boolean.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020049# (3) Specified user= string before unspecified user= string;
Alan Stokes6b576bd2019-01-31 15:16:01 +000050# more specific user= string before less specific user= string.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020051# (4) Specified seinfo= string before unspecified seinfo= string.
52# (5) Specified name= string before unspecified name= string;
Alan Stokes6b576bd2019-01-31 15:16:01 +000053# more specific name= string before less specific name= string.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020054# (6) Specified isPrivApp= before unspecified isPrivApp= boolean.
55# (7) Higher value of minTargetSdkVersion= before lower value of
Alan Stokes6b576bd2019-01-31 15:16:01 +000056# minTargetSdkVersion= integer. Note that minTargetSdkVersion=
57# defaults to 0 if unspecified.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020058# (8) fromRunAs=true before fromRunAs=false.
Alan Stokes6b576bd2019-01-31 15:16:01 +000059# (A fixed selector is more specific than a prefix, i.e. ending in *, and a
60# longer prefix is more specific than a shorter prefix.)
61# Apps are checked against entries in precedence order until the first match,
62# regardless of their order in this file.
63#
64# Duplicate entries, i.e. with identical input selectors, are not allowed.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050065#
66# Outputs:
Michael Peckf54b3622017-02-14 09:48:57 -080067# domain (string)
68# type (string)
69# levelFrom (string; one of none, all, app, or user)
70# level (string)
Alan Stokes6b576bd2019-01-31 15:16:01 +000071#
72# domain= determines the label to be used for the app process; entries
73# without domain= are ignored for this purpose.
74# type= specifies the label to be used for the app data directory; entries
Alan Stokesf8ad3392020-10-27 17:35:33 +000075# without type= are ignored for this purpose. The label specified must
76# have the app_data_file_type attribute.
Alan Stokes6b576bd2019-01-31 15:16:01 +000077# levelFrom and level are used to determine the level (sensitivity + categories)
78# for MLS/MCS.
79# levelFrom=none omits the level.
80# levelFrom=app determines the level from the process UID.
81# levelFrom=user determines the level from the user ID.
82# levelFrom=all determines the level from both UID and user ID.
Nick Kralevich795add52019-04-16 15:56:33 -070083#
Stephen Smalley38084142012-11-28 10:46:18 -050084# levelFrom=user is only supported for _app or _isolated UIDs.
85# levelFrom=app or levelFrom=all is only supported for _app UIDs.
Nick Kralevich4be31902014-07-01 13:59:50 -070086# level may be used to specify a fixed level for any UID.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050087#
Alan Stokes6b576bd2019-01-31 15:16:01 +000088# For backwards compatibility levelFromUid=true is equivalent to levelFrom=app
89# and levelFromUid=false is equivalent to levelFrom=none.
90#
William Roberts81e1f902015-06-03 21:57:47 -070091#
92# Neverallow Assertions
Alan Stokes6b576bd2019-01-31 15:16:01 +000093# Additional compile time assertion checks for the rules in this file can be
94# added as well. The assertion
William Roberts81e1f902015-06-03 21:57:47 -070095# rules are lines beginning with the keyword neverallow. Full support for PCRE
96# regular expressions exists on all input and output selectors. Neverallow
97# rules are never output to the built seapp_contexts file. Like all keywords,
98# neverallows are case-insensitive. A neverallow is asserted when all key value
99# inputs are matched on a key value rule line.
100#
101
102# only the system server can be in system_server domain
103neverallow isSystemServer=false domain=system_server
104neverallow isSystemServer="" domain=system_server
105
106# system domains should never be assigned outside of system uid
107neverallow user=((?!system).)* domain=system_app
108neverallow user=((?!system).)* type=system_app_data_file
109
Ashwini Oruganti04f771d2019-10-31 15:45:00 -0700110# any non priv-app with a non-known uid with a specified name should have a specified
111# seinfo
112neverallow user=_app isPrivApp=false name=.* seinfo=""
113neverallow user=_app isPrivApp=false name=.* seinfo=default
William Roberts81e1f902015-06-03 21:57:47 -0700114
115# neverallow shared relro to any other domain
116# and neverallow any other uid into shared_relro
117neverallow user=shared_relro domain=((?!shared_relro).)*
118neverallow user=((?!shared_relro).)* domain=shared_relro
119
120# neverallow non-isolated uids into isolated_app domain
121# and vice versa
122neverallow user=_isolated domain=((?!isolated_app).)*
123neverallow user=((?!_isolated).)* domain=isolated_app
124
125# uid shell should always be in shell domain, however non-shell
126# uid's can be in shell domain
127neverallow user=shell domain=((?!shell).)*
128
Max Bires77d41f72018-01-24 21:17:18 +0000129# only the package named com.android.shell can run in the shell domain
130neverallow domain=shell name=((?!com\.android\.shell).)*
131neverallow user=shell name=((?!com\.android\.shell).)*
132
Chad Brubaker06cf31e2016-10-06 13:15:44 -0700133# Ephemeral Apps must run in the ephemeral_app domain
134neverallow isEphemeralApp=true domain=((?!ephemeral_app).)*
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -0700135
Nick Kralevichcaf42d62018-10-04 10:57:29 -0700136isSystemServer=true domain=system_server_startup
137
Collin Fijalkovich057c7d62020-08-28 16:10:36 -0700138user=_app isPrivApp=true name=com.android.traceur domain=traceur_app type=app_data_file levelFrom=all
Max Bires23f0f3b2020-12-23 21:53:08 -0800139user=_app isPrivApp=true name=com.android.remoteprovisioner domain=remote_prov_app type=app_data_file levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700140user=system seinfo=platform domain=system_app type=system_app_data_file
141user=bluetooth seinfo=platform domain=bluetooth type=bluetooth_data_file
markchien48c600f2020-11-26 09:55:56 +0800142user=network_stack seinfo=network_stack domain=network_stack type=radio_data_file
William Roberts92dfa312014-09-29 10:29:48 -0700143user=nfc seinfo=platform domain=nfc type=nfc_data_file
Ruchi Kandoi8a2b4a72018-01-04 10:33:20 -0800144user=secure_element seinfo=platform domain=secure_element levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700145user=radio seinfo=platform domain=radio type=radio_data_file
Alan Stokesc7229c72020-09-24 13:46:46 +0100146user=shared_relro domain=shared_relro levelFrom=all
Max Bires77d41f72018-01-24 21:17:18 +0000147user=shell seinfo=platform domain=shell name=com.android.shell type=shell_data_file
Robert Sesekbacb19b2018-01-30 10:54:33 -0500148user=webview_zygote seinfo=webview_zygote domain=webview_zygote
Martijn Coenend40dfdc2020-06-08 20:31:33 +0200149user=_isolated domain=isolated_app levelFrom=user
150user=_app seinfo=app_zygote domain=app_zygote levelFrom=user
Jeff Vander Stoepfcf12fd2020-04-22 15:26:02 +0200151user=_app seinfo=media domain=mediaprovider type=app_data_file levelFrom=user
Stephen Smalleya8337632014-09-11 14:07:28 -0400152user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user
Nick Kralevich795add52019-04-16 15:56:33 -0700153user=_app isEphemeralApp=true domain=ephemeral_app type=app_data_file levelFrom=all
Nick Kralevich5d175512018-09-12 12:30:32 -0700154user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user
Ashwini Oruganti04f771d2019-10-31 15:45:00 -0700155user=_app isPrivApp=true name=com.google.android.permissioncontroller domain=permissioncontroller_app type=privapp_data_file levelFrom=all
Jeff Vander Stoepfcf12fd2020-04-22 15:26:02 +0200156user=_app seinfo=media isPrivApp=true name=com.android.providers.media.module domain=mediaprovider_app type=privapp_data_file levelFrom=all
Martijn Coenene3f1d5a2020-01-30 16:52:45 +0100157user=_app isPrivApp=true name=com.google.android.providers.media.module domain=mediaprovider_app type=privapp_data_file levelFrom=all
Ashwini Orugantib3bffe82020-06-15 11:14:04 -0700158user=_app seinfo=platform isPrivApp=true name=com.android.permissioncontroller domain=permissioncontroller_app type=privapp_data_file levelFrom=all
Ashwini Orugantic77ff372019-11-14 14:00:30 -0800159user=_app isPrivApp=true name=com.android.vzwomatrigger domain=vzwomatrigger_app type=privapp_data_file levelFrom=all
Ashwini Orugantic46a7bc2019-10-29 14:13:20 -0700160user=_app isPrivApp=true name=com.google.android.gms domain=gmscore_app type=privapp_data_file levelFrom=user
161user=_app isPrivApp=true name=com.google.android.gms.* domain=gmscore_app type=privapp_data_file levelFrom=user
162user=_app isPrivApp=true name=com.google.android.gms:* domain=gmscore_app type=privapp_data_file levelFrom=user
Ashwini Orugantiefc3bdb2020-04-22 10:22:45 -0700163user=_app isPrivApp=true name=com.google.android.gsf domain=gmscore_app type=privapp_data_file levelFrom=user
Bram Bonnéea5460a2021-05-12 14:19:24 +0200164user=_app minTargetSdkVersion=32 domain=untrusted_app type=app_data_file levelFrom=all
165user=_app minTargetSdkVersion=30 domain=untrusted_app_30 type=app_data_file levelFrom=all
Jeff Vander Stoep1f7ae8e2020-01-20 10:14:48 +0100166user=_app minTargetSdkVersion=29 domain=untrusted_app_29 type=app_data_file levelFrom=all
Yabin Cui5dc2c8c2018-11-02 11:12:43 -0700167user=_app minTargetSdkVersion=28 domain=untrusted_app_27 type=app_data_file levelFrom=all
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800168user=_app minTargetSdkVersion=26 domain=untrusted_app_27 type=app_data_file levelFrom=user
Jeff Vander Stoepbacb6d72017-02-13 13:33:27 -0800169user=_app domain=untrusted_app_25 type=app_data_file levelFrom=user
Yabin Cui770a4f62019-01-07 16:37:24 -0800170user=_app minTargetSdkVersion=28 fromRunAs=true domain=runas_app levelFrom=all
171user=_app fromRunAs=true domain=runas_app levelFrom=user