blob: cbbdd6498d7e97bd5f22812151021e60574f0b83 [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)
Chad Brubakera782a812017-02-06 10:31:45 -08008# isV2App (boolean)
Michael Peckf54b3622017-02-14 09:48:57 -08009# isOwner (boolean)
10# user (string)
11# seinfo (string)
12# name (string)
13# path (string)
14# isPrivApp (boolean)
15# minTargetSdkVersion (unsigned integer)
Yabin Cuiffa2b612018-11-02 14:34:06 -070016# fromRunAs (boolean)
Alan Stokes6b576bd2019-01-31 15:16:01 +000017#
18# All specified input selectors in an entry must match (i.e. logical AND).
19# An unspecified string or boolean selector with no default will match any
20# value.
21# A user, name, or path string selector that ends in * will perform a prefix
22# match.
23# String matching is case-insensitive.
24# See external/selinux/libselinux/src/android/android_platform.c,
25# seapp_context_lookup().
26#
27# isSystemServer=true only matches the system server.
Stephen Smalleydd31ddf2012-07-27 17:08:21 -040028# An unspecified isSystemServer defaults to false.
Chad Brubaker06cf31e2016-10-06 13:15:44 -070029# isEphemeralApp=true will match apps marked by PackageManager as Ephemeral
Chad Brubakera782a812017-02-06 10:31:45 -080030# isV2App=true will match apps in the v2 app sandbox.
Stephen Smalleyff4db912014-09-15 15:16:06 -040031# isOwner=true will only match for the owner/primary user.
Alan Stokes6b576bd2019-01-31 15:16:01 +000032# user=_app will match any regular app process.
33# user=_isolated will match any isolated service process.
34# Other values of user are matched against the name associated with the process
35# UID.
36# seinfo= matches aginst the seinfo tag for the app, determined from
37# mac_permissions.xml files.
38# The ':' character is reserved and may not be used in seinfo.
39# name= matches against the package name of the app.
40# path= matches against the directory path when labeling app directories.
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -070041# isPrivApp=true will only match for applications preinstalled in
42# /system/priv-app.
Michael Peckf54b3622017-02-14 09:48:57 -080043# minTargetSdkVersion will match applications with a targetSdkVersion
44# greater than or equal to the specified value. If unspecified,
45# it has a default value of 0.
Alan Stokes6b576bd2019-01-31 15:16:01 +000046# fromRunAs=true means the process being labeled is started by run-as. Default
47# is false.
Nick Kralevich4be31902014-07-01 13:59:50 -070048#
Alan Stokes6b576bd2019-01-31 15:16:01 +000049# Precedence: entries are compared using the following rules, in the order shown
50# (see external/selinux/libselinux/src/android/android_platform.c,
51# seapp_context_cmp()).
Michael Peckf54b3622017-02-14 09:48:57 -080052# (1) isSystemServer=true before isSystemServer=false.
Alan Stokes6b576bd2019-01-31 15:16:01 +000053# (2) Specified isEphemeralApp= before unspecified isEphemeralApp=
54# boolean.
Chad Brubakera782a812017-02-06 10:31:45 -080055# (3) Specified isV2App= before unspecified isV2App= boolean.
56# (4) Specified isOwner= before unspecified isOwner= boolean.
Alan Stokes6b576bd2019-01-31 15:16:01 +000057# (5) Specified user= string before unspecified user= string;
58# more specific user= string before less specific user= string.
59# (6) Specified seinfo= string before unspecified seinfo= string.
60# (7) Specified name= string before unspecified name= string;
61# more specific name= string before less specific name= string.
62# (8) Specified path= string before unspecified path= string.
63# more specific name= string before less specific name= string.
64# (9) Specified isPrivApp= before unspecified isPrivApp= boolean.
65# (10) Higher value of minTargetSdkVersion= before lower value of
66# minTargetSdkVersion= integer. Note that minTargetSdkVersion=
67# defaults to 0 if unspecified.
68# (11) fromRunAs=true before fromRunAs=false.
69# (A fixed selector is more specific than a prefix, i.e. ending in *, and a
70# longer prefix is more specific than a shorter prefix.)
71# Apps are checked against entries in precedence order until the first match,
72# regardless of their order in this file.
73#
74# Duplicate entries, i.e. with identical input selectors, are not allowed.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050075#
76# Outputs:
Michael Peckf54b3622017-02-14 09:48:57 -080077# domain (string)
78# type (string)
79# levelFrom (string; one of none, all, app, or user)
80# level (string)
Alan Stokes6b576bd2019-01-31 15:16:01 +000081#
82# domain= determines the label to be used for the app process; entries
83# without domain= are ignored for this purpose.
84# type= specifies the label to be used for the app data directory; entries
85# without type= are ignored for this purpose.
86# levelFrom and level are used to determine the level (sensitivity + categories)
87# for MLS/MCS.
88# levelFrom=none omits the level.
89# levelFrom=app determines the level from the process UID.
90# levelFrom=user determines the level from the user ID.
91# levelFrom=all determines the level from both UID and user ID.
92#
Stephen Smalley38084142012-11-28 10:46:18 -050093# levelFrom=user is only supported for _app or _isolated UIDs.
94# levelFrom=app or levelFrom=all is only supported for _app UIDs.
Nick Kralevich4be31902014-07-01 13:59:50 -070095# level may be used to specify a fixed level for any UID.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050096#
Alan Stokes6b576bd2019-01-31 15:16:01 +000097# For backwards compatibility levelFromUid=true is equivalent to levelFrom=app
98# and levelFromUid=false is equivalent to levelFrom=none.
99#
William Roberts81e1f902015-06-03 21:57:47 -0700100#
101# Neverallow Assertions
Alan Stokes6b576bd2019-01-31 15:16:01 +0000102# Additional compile time assertion checks for the rules in this file can be
103# added as well. The assertion
William Roberts81e1f902015-06-03 21:57:47 -0700104# rules are lines beginning with the keyword neverallow. Full support for PCRE
105# regular expressions exists on all input and output selectors. Neverallow
106# rules are never output to the built seapp_contexts file. Like all keywords,
107# neverallows are case-insensitive. A neverallow is asserted when all key value
108# inputs are matched on a key value rule line.
109#
110
111# only the system server can be in system_server domain
112neverallow isSystemServer=false domain=system_server
113neverallow isSystemServer="" domain=system_server
114
115# system domains should never be assigned outside of system uid
116neverallow user=((?!system).)* domain=system_app
117neverallow user=((?!system).)* type=system_app_data_file
118
119# anything with a non-known uid with a specified name should have a specified seinfo
120neverallow user=_app name=.* seinfo=""
121neverallow user=_app name=.* seinfo=default
122
123# neverallow shared relro to any other domain
124# and neverallow any other uid into shared_relro
125neverallow user=shared_relro domain=((?!shared_relro).)*
126neverallow user=((?!shared_relro).)* domain=shared_relro
127
128# neverallow non-isolated uids into isolated_app domain
129# and vice versa
130neverallow user=_isolated domain=((?!isolated_app).)*
131neverallow user=((?!_isolated).)* domain=isolated_app
132
133# uid shell should always be in shell domain, however non-shell
134# uid's can be in shell domain
135neverallow user=shell domain=((?!shell).)*
136
Max Bires77d41f72018-01-24 21:17:18 +0000137# only the package named com.android.shell can run in the shell domain
138neverallow domain=shell name=((?!com\.android\.shell).)*
139neverallow user=shell name=((?!com\.android\.shell).)*
140
Chad Brubaker06cf31e2016-10-06 13:15:44 -0700141# Ephemeral Apps must run in the ephemeral_app domain
142neverallow isEphemeralApp=true domain=((?!ephemeral_app).)*
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -0700143
Nick Kralevichcaf42d62018-10-04 10:57:29 -0700144isSystemServer=true domain=system_server_startup
145
Max Bires4ea55692017-12-11 16:19:23 -0800146user=_app seinfo=platform name=com.android.traceur domain=traceur_app type=app_data_file levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700147user=system seinfo=platform domain=system_app type=system_app_data_file
148user=bluetooth seinfo=platform domain=bluetooth type=bluetooth_data_file
Xiao Mac06f0f62019-03-08 12:33:03 +0900149user=network_stack seinfo=network_stack domain=network_stack levelFrom=all type=radio_data_file
William Roberts92dfa312014-09-29 10:29:48 -0700150user=nfc seinfo=platform domain=nfc type=nfc_data_file
Ruchi Kandoi8a2b4a72018-01-04 10:33:20 -0800151user=secure_element seinfo=platform domain=secure_element levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700152user=radio seinfo=platform domain=radio type=radio_data_file
Nick Kralevichb5ffbb72015-01-07 13:52:43 -0800153user=shared_relro domain=shared_relro
Max Bires77d41f72018-01-24 21:17:18 +0000154user=shell seinfo=platform domain=shell name=com.android.shell type=shell_data_file
Robert Sesekbacb19b2018-01-30 10:54:33 -0500155user=webview_zygote seinfo=webview_zygote domain=webview_zygote
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800156user=_isolated domain=isolated_app levelFrom=all
Martijn Coenen1bbda7e2018-11-05 11:39:15 +0100157user=_app seinfo=app_zygote domain=app_zygote levelFrom=all
Jerry Zhang9f152d92017-04-10 16:57:48 -0700158user=_app seinfo=media domain=mediaprovider name=android.process.media type=app_data_file levelFrom=user
Stephen Smalleya8337632014-09-11 14:07:28 -0400159user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800160user=_app isV2App=true isEphemeralApp=true domain=ephemeral_app type=app_data_file levelFrom=all
Nick Kralevich5d175512018-09-12 12:30:32 -0700161user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user
Yabin Cui5dc2c8c2018-11-02 11:12:43 -0700162user=_app minTargetSdkVersion=29 domain=untrusted_app type=app_data_file levelFrom=all
163user=_app minTargetSdkVersion=28 domain=untrusted_app_27 type=app_data_file levelFrom=all
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800164user=_app minTargetSdkVersion=26 domain=untrusted_app_27 type=app_data_file levelFrom=user
Jeff Vander Stoepbacb6d72017-02-13 13:33:27 -0800165user=_app domain=untrusted_app_25 type=app_data_file levelFrom=user
Yabin Cui770a4f62019-01-07 16:37:24 -0800166user=_app minTargetSdkVersion=28 fromRunAs=true domain=runas_app levelFrom=all
167user=_app fromRunAs=true domain=runas_app levelFrom=user