blob: 418150e71378e45f9157386fe6bea05940799ec5 [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)
Stephen Smalley2dd4e512012-01-04 12:33:27 -050012# isSystemServer=true can only be used once.
Stephen Smalleydd31ddf2012-07-27 17:08:21 -040013# An unspecified isSystemServer defaults to false.
Chad Brubaker06cf31e2016-10-06 13:15:44 -070014# isEphemeralApp=true will match apps marked by PackageManager as Ephemeral
Chad Brubakera782a812017-02-06 10:31:45 -080015# isV2App=true will match apps in the v2 app sandbox.
Stephen Smalleyff4db912014-09-15 15:16:06 -040016# isOwner=true will only match for the owner/primary user.
17# isOwner=false will only match for secondary users.
18# If unspecified, the entry can match either case.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050019# An unspecified string selector will match any value.
20# A user string selector that ends in * will perform a prefix match.
Stephen Smalley3ac1d262012-09-24 10:16:03 -040021# user=_app will match any regular app UID.
22# user=_isolated will match any isolated service UID.
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -070023# isPrivApp=true will only match for applications preinstalled in
24# /system/priv-app.
Michael Peckf54b3622017-02-14 09:48:57 -080025# minTargetSdkVersion will match applications with a targetSdkVersion
26# greater than or equal to the specified value. If unspecified,
27# it has a default value of 0.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050028# All specified input selectors in an entry must match (i.e. logical AND).
29# Matching is case-insensitive.
Nick Kralevich4be31902014-07-01 13:59:50 -070030#
Alex Klyubine3920202016-12-19 10:18:19 -080031# Precedence rules (see external/selinux/libselinux/src/android/android.c seapp_context_cmp()):
Michael Peckf54b3622017-02-14 09:48:57 -080032# (1) isSystemServer=true before isSystemServer=false.
33# (2) Specified isEphemeralApp= before unspecified isEphemeralApp= boolean.
Chad Brubakera782a812017-02-06 10:31:45 -080034# (3) Specified isV2App= before unspecified isV2App= boolean.
35# (4) Specified isOwner= before unspecified isOwner= boolean.
36# (5) Specified user= string before unspecified user= string.
37# (6) Fixed user= string before user= prefix (i.e. ending in *).
38# (7) Longer user= prefix before shorter user= prefix.
39# (8) Specified seinfo= string before unspecified seinfo= string.
Michael Peckf54b3622017-02-14 09:48:57 -080040# ':' character is reserved and may not be used.
Chad Brubakera782a812017-02-06 10:31:45 -080041# (9) Specified name= string before unspecified name= string.
42# (10) Specified path= string before unspecified path= string.
43# (11) Specified isPrivApp= before unspecified isPrivApp= boolean.
44# (12) Higher value of minTargetSdkVersion= before lower value of minTargetSdkVersion=
Michael Peckf54b3622017-02-14 09:48:57 -080045# integer. Note that minTargetSdkVersion= defaults to 0 if unspecified.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050046#
47# Outputs:
Michael Peckf54b3622017-02-14 09:48:57 -080048# domain (string)
49# type (string)
50# levelFrom (string; one of none, all, app, or user)
51# level (string)
Stephen Smalley2dd4e512012-01-04 12:33:27 -050052# Only entries that specify domain= will be used for app process labeling.
53# Only entries that specify type= will be used for app directory labeling.
Stephen Smalley38084142012-11-28 10:46:18 -050054# levelFrom=user is only supported for _app or _isolated UIDs.
55# levelFrom=app or levelFrom=all is only supported for _app UIDs.
Nick Kralevich4be31902014-07-01 13:59:50 -070056# level may be used to specify a fixed level for any UID.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050057#
William Roberts81e1f902015-06-03 21:57:47 -070058#
59# Neverallow Assertions
60# Additional compile time assertion checks can be added as well. The assertion
61# rules are lines beginning with the keyword neverallow. Full support for PCRE
62# regular expressions exists on all input and output selectors. Neverallow
63# rules are never output to the built seapp_contexts file. Like all keywords,
64# neverallows are case-insensitive. A neverallow is asserted when all key value
65# inputs are matched on a key value rule line.
66#
67
68# only the system server can be in system_server domain
69neverallow isSystemServer=false domain=system_server
70neverallow isSystemServer="" domain=system_server
71
72# system domains should never be assigned outside of system uid
73neverallow user=((?!system).)* domain=system_app
74neverallow user=((?!system).)* type=system_app_data_file
75
76# anything with a non-known uid with a specified name should have a specified seinfo
77neverallow user=_app name=.* seinfo=""
78neverallow user=_app name=.* seinfo=default
79
80# neverallow shared relro to any other domain
81# and neverallow any other uid into shared_relro
82neverallow user=shared_relro domain=((?!shared_relro).)*
83neverallow user=((?!shared_relro).)* domain=shared_relro
84
85# neverallow non-isolated uids into isolated_app domain
86# and vice versa
87neverallow user=_isolated domain=((?!isolated_app).)*
88neverallow user=((?!_isolated).)* domain=isolated_app
89
90# uid shell should always be in shell domain, however non-shell
91# uid's can be in shell domain
92neverallow user=shell domain=((?!shell).)*
93
Max Bires77d41f72018-01-24 21:17:18 +000094# only the package named com.android.shell can run in the shell domain
95neverallow domain=shell name=((?!com\.android\.shell).)*
96neverallow user=shell name=((?!com\.android\.shell).)*
97
Chad Brubaker06cf31e2016-10-06 13:15:44 -070098# Ephemeral Apps must run in the ephemeral_app domain
99neverallow isEphemeralApp=true domain=((?!ephemeral_app).)*
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -0700100
Alex Klyubin1fdee112013-09-13 15:59:04 -0700101isSystemServer=true domain=system_server
Max Bires4ea55692017-12-11 16:19:23 -0800102user=_app seinfo=platform name=com.android.traceur domain=traceur_app type=app_data_file levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700103user=system seinfo=platform domain=system_app type=system_app_data_file
104user=bluetooth seinfo=platform domain=bluetooth type=bluetooth_data_file
105user=nfc seinfo=platform domain=nfc type=nfc_data_file
Ruchi Kandoi8a2b4a72018-01-04 10:33:20 -0800106user=secure_element seinfo=platform domain=secure_element levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700107user=radio seinfo=platform domain=radio type=radio_data_file
Nick Kralevichb5ffbb72015-01-07 13:52:43 -0800108user=shared_relro domain=shared_relro
Max Bires77d41f72018-01-24 21:17:18 +0000109user=shell seinfo=platform domain=shell name=com.android.shell type=shell_data_file
Robert Sesekbacb19b2018-01-30 10:54:33 -0500110user=webview_zygote seinfo=webview_zygote domain=webview_zygote
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800111user=_isolated domain=isolated_app levelFrom=all
Jerry Zhang9f152d92017-04-10 16:57:48 -0700112user=_app seinfo=media domain=mediaprovider name=android.process.media type=app_data_file levelFrom=user
Stephen Smalleya8337632014-09-11 14:07:28 -0400113user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800114user=_app isV2App=true isEphemeralApp=true domain=ephemeral_app type=app_data_file levelFrom=all
Nick Kralevich4df57822018-08-03 09:01:42 -0700115user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800116user=_app minTargetSdkVersion=28 domain=untrusted_app type=app_data_file levelFrom=all
117user=_app minTargetSdkVersion=26 domain=untrusted_app_27 type=app_data_file levelFrom=user
Jeff Vander Stoepbacb6d72017-02-13 13:33:27 -0800118user=_app domain=untrusted_app_25 type=app_data_file levelFrom=user