blob: 55391ea36ba96d2e9a695e76825aabf8cfbab374 [file] [log] [blame]
Nick Kralevich4be31902014-07-01 13:59:50 -07001# Input selectors:
Michael Peckf54b3622017-02-14 09:48:57 -08002# isSystemServer (boolean)
3# isEphemeralApp (boolean)
Chad Brubakera782a812017-02-06 10:31:45 -08004# isV2App (boolean)
Michael Peckf54b3622017-02-14 09:48:57 -08005# isOwner (boolean)
6# user (string)
7# seinfo (string)
8# name (string)
9# path (string)
10# isPrivApp (boolean)
11# minTargetSdkVersion (unsigned integer)
Yabin Cuiffa2b612018-11-02 14:34:06 -070012# fromRunAs (boolean)
Stephen Smalley2dd4e512012-01-04 12:33:27 -050013# isSystemServer=true can only be used once.
Stephen Smalleydd31ddf2012-07-27 17:08:21 -040014# An unspecified isSystemServer defaults to false.
Chad Brubaker06cf31e2016-10-06 13:15:44 -070015# isEphemeralApp=true will match apps marked by PackageManager as Ephemeral
Chad Brubakera782a812017-02-06 10:31:45 -080016# isV2App=true will match apps in the v2 app sandbox.
Stephen Smalleyff4db912014-09-15 15:16:06 -040017# isOwner=true will only match for the owner/primary user.
18# isOwner=false will only match for secondary users.
19# If unspecified, the entry can match either case.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050020# An unspecified string selector will match any value.
21# A user string selector that ends in * will perform a prefix match.
Stephen Smalley3ac1d262012-09-24 10:16:03 -040022# user=_app will match any regular app UID.
23# user=_isolated will match any isolated service UID.
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -070024# isPrivApp=true will only match for applications preinstalled in
25# /system/priv-app.
Michael Peckf54b3622017-02-14 09:48:57 -080026# minTargetSdkVersion will match applications with a targetSdkVersion
27# greater than or equal to the specified value. If unspecified,
28# it has a default value of 0.
Yabin Cuiffa2b612018-11-02 14:34:06 -070029# fromRunAs=true means the setcontext request is from run-as. Default is false.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050030# All specified input selectors in an entry must match (i.e. logical AND).
31# Matching is case-insensitive.
Nick Kralevich4be31902014-07-01 13:59:50 -070032#
Alex Klyubine3920202016-12-19 10:18:19 -080033# Precedence rules (see external/selinux/libselinux/src/android/android.c seapp_context_cmp()):
Michael Peckf54b3622017-02-14 09:48:57 -080034# (1) isSystemServer=true before isSystemServer=false.
35# (2) Specified isEphemeralApp= before unspecified isEphemeralApp= boolean.
Chad Brubakera782a812017-02-06 10:31:45 -080036# (3) Specified isV2App= before unspecified isV2App= boolean.
37# (4) Specified isOwner= before unspecified isOwner= boolean.
38# (5) Specified user= string before unspecified user= string.
39# (6) Fixed user= string before user= prefix (i.e. ending in *).
40# (7) Longer user= prefix before shorter user= prefix.
41# (8) Specified seinfo= string before unspecified seinfo= string.
Michael Peckf54b3622017-02-14 09:48:57 -080042# ':' character is reserved and may not be used.
Chad Brubakera782a812017-02-06 10:31:45 -080043# (9) Specified name= string before unspecified name= string.
44# (10) Specified path= string before unspecified path= string.
45# (11) Specified isPrivApp= before unspecified isPrivApp= boolean.
46# (12) Higher value of minTargetSdkVersion= before lower value of minTargetSdkVersion=
Michael Peckf54b3622017-02-14 09:48:57 -080047# integer. Note that minTargetSdkVersion= defaults to 0 if unspecified.
Yabin Cuiffa2b612018-11-02 14:34:06 -070048# (13) fromRunAs=true before fromRunAs=false.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050049#
50# Outputs:
Michael Peckf54b3622017-02-14 09:48:57 -080051# domain (string)
52# type (string)
53# levelFrom (string; one of none, all, app, or user)
54# level (string)
Stephen Smalley2dd4e512012-01-04 12:33:27 -050055# Only entries that specify domain= will be used for app process labeling.
56# Only entries that specify type= will be used for app directory labeling.
Stephen Smalley38084142012-11-28 10:46:18 -050057# levelFrom=user is only supported for _app or _isolated UIDs.
58# levelFrom=app or levelFrom=all is only supported for _app UIDs.
Nick Kralevich4be31902014-07-01 13:59:50 -070059# level may be used to specify a fixed level for any UID.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050060#
William Roberts81e1f902015-06-03 21:57:47 -070061#
62# Neverallow Assertions
63# Additional compile time assertion checks can be added as well. The assertion
64# rules are lines beginning with the keyword neverallow. Full support for PCRE
65# regular expressions exists on all input and output selectors. Neverallow
66# rules are never output to the built seapp_contexts file. Like all keywords,
67# neverallows are case-insensitive. A neverallow is asserted when all key value
68# inputs are matched on a key value rule line.
69#
70
71# only the system server can be in system_server domain
72neverallow isSystemServer=false domain=system_server
73neverallow isSystemServer="" domain=system_server
74
75# system domains should never be assigned outside of system uid
76neverallow user=((?!system).)* domain=system_app
77neverallow user=((?!system).)* type=system_app_data_file
78
79# anything with a non-known uid with a specified name should have a specified seinfo
80neverallow user=_app name=.* seinfo=""
81neverallow user=_app name=.* seinfo=default
82
83# neverallow shared relro to any other domain
84# and neverallow any other uid into shared_relro
85neverallow user=shared_relro domain=((?!shared_relro).)*
86neverallow user=((?!shared_relro).)* domain=shared_relro
87
88# neverallow non-isolated uids into isolated_app domain
89# and vice versa
90neverallow user=_isolated domain=((?!isolated_app).)*
91neverallow user=((?!_isolated).)* domain=isolated_app
92
93# uid shell should always be in shell domain, however non-shell
94# uid's can be in shell domain
95neverallow user=shell domain=((?!shell).)*
96
Max Bires77d41f72018-01-24 21:17:18 +000097# only the package named com.android.shell can run in the shell domain
98neverallow domain=shell name=((?!com\.android\.shell).)*
99neverallow user=shell name=((?!com\.android\.shell).)*
100
Chad Brubaker06cf31e2016-10-06 13:15:44 -0700101# Ephemeral Apps must run in the ephemeral_app domain
102neverallow isEphemeralApp=true domain=((?!ephemeral_app).)*
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -0700103
Nick Kralevichcaf42d62018-10-04 10:57:29 -0700104isSystemServer=true domain=system_server_startup
105
Max Bires4ea55692017-12-11 16:19:23 -0800106user=_app seinfo=platform name=com.android.traceur domain=traceur_app type=app_data_file levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700107user=system seinfo=platform domain=system_app type=system_app_data_file
108user=bluetooth seinfo=platform domain=bluetooth type=bluetooth_data_file
109user=nfc seinfo=platform domain=nfc type=nfc_data_file
Ruchi Kandoi8a2b4a72018-01-04 10:33:20 -0800110user=secure_element seinfo=platform domain=secure_element levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700111user=radio seinfo=platform domain=radio type=radio_data_file
Nick Kralevichb5ffbb72015-01-07 13:52:43 -0800112user=shared_relro domain=shared_relro
Max Bires77d41f72018-01-24 21:17:18 +0000113user=shell seinfo=platform domain=shell name=com.android.shell type=shell_data_file
Robert Sesekbacb19b2018-01-30 10:54:33 -0500114user=webview_zygote seinfo=webview_zygote domain=webview_zygote
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800115user=_isolated domain=isolated_app levelFrom=all
Jerry Zhang9f152d92017-04-10 16:57:48 -0700116user=_app seinfo=media domain=mediaprovider name=android.process.media type=app_data_file levelFrom=user
Stephen Smalleya8337632014-09-11 14:07:28 -0400117user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800118user=_app isV2App=true isEphemeralApp=true domain=ephemeral_app type=app_data_file levelFrom=all
Nick Kralevich5d175512018-09-12 12:30:32 -0700119user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user
Yabin Cui5dc2c8c2018-11-02 11:12:43 -0700120user=_app minTargetSdkVersion=29 domain=untrusted_app type=app_data_file levelFrom=all
121user=_app minTargetSdkVersion=28 domain=untrusted_app_27 type=app_data_file levelFrom=all
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800122user=_app minTargetSdkVersion=26 domain=untrusted_app_27 type=app_data_file levelFrom=user
Jeff Vander Stoepbacb6d72017-02-13 13:33:27 -0800123user=_app domain=untrusted_app_25 type=app_data_file levelFrom=user
Yabin Cuiffa2b612018-11-02 14:34:06 -0700124user=_app fromRunAs=true domain=runas_app levelFrom=all