blob: ee2740a4c42cd663a1a2b143572743a039ef7bbd [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)
4# isOwner (boolean)
5# user (string)
6# seinfo (string)
7# name (string)
8# path (string)
9# isPrivApp (boolean)
10# minTargetSdkVersion (unsigned integer)
Stephen Smalley2dd4e512012-01-04 12:33:27 -050011# isSystemServer=true can only be used once.
Stephen Smalleydd31ddf2012-07-27 17:08:21 -040012# An unspecified isSystemServer defaults to false.
Chad Brubaker06cf31e2016-10-06 13:15:44 -070013# isEphemeralApp=true will match apps marked by PackageManager as Ephemeral
Stephen Smalleyff4db912014-09-15 15:16:06 -040014# isOwner=true will only match for the owner/primary user.
15# isOwner=false will only match for secondary users.
16# If unspecified, the entry can match either case.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050017# An unspecified string selector will match any value.
18# A user string selector that ends in * will perform a prefix match.
Stephen Smalley3ac1d262012-09-24 10:16:03 -040019# user=_app will match any regular app UID.
20# user=_isolated will match any isolated service UID.
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -070021# isPrivApp=true will only match for applications preinstalled in
22# /system/priv-app.
Michael Peckf54b3622017-02-14 09:48:57 -080023# minTargetSdkVersion will match applications with a targetSdkVersion
24# greater than or equal to the specified value. If unspecified,
25# it has a default value of 0.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050026# All specified input selectors in an entry must match (i.e. logical AND).
27# Matching is case-insensitive.
Nick Kralevich4be31902014-07-01 13:59:50 -070028#
Alex Klyubine3920202016-12-19 10:18:19 -080029# Precedence rules (see external/selinux/libselinux/src/android/android.c seapp_context_cmp()):
Michael Peckf54b3622017-02-14 09:48:57 -080030# (1) isSystemServer=true before isSystemServer=false.
31# (2) Specified isEphemeralApp= before unspecified isEphemeralApp= boolean.
32# (3) Specified isOwner= before unspecified isOwner= boolean.
33# (4) Specified user= string before unspecified user= string.
34# (5) Fixed user= string before user= prefix (i.e. ending in *).
35# (6) Longer user= prefix before shorter user= prefix.
36# (7) Specified seinfo= string before unspecified seinfo= string.
37# ':' character is reserved and may not be used.
38# (8) Specified name= string before unspecified name= string.
39# (9) Specified path= string before unspecified path= string.
40# (10) Specified isPrivApp= before unspecified isPrivApp= boolean.
41# (11) Higher value of minTargetSdkVersion= before lower value of minTargetSdkVersion=
42# integer. Note that minTargetSdkVersion= defaults to 0 if unspecified.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050043#
44# Outputs:
Michael Peckf54b3622017-02-14 09:48:57 -080045# domain (string)
46# type (string)
47# levelFrom (string; one of none, all, app, or user)
48# level (string)
Stephen Smalley2dd4e512012-01-04 12:33:27 -050049# Only entries that specify domain= will be used for app process labeling.
50# Only entries that specify type= will be used for app directory labeling.
Stephen Smalley38084142012-11-28 10:46:18 -050051# levelFrom=user is only supported for _app or _isolated UIDs.
52# levelFrom=app or levelFrom=all is only supported for _app UIDs.
Nick Kralevich4be31902014-07-01 13:59:50 -070053# level may be used to specify a fixed level for any UID.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050054#
William Roberts81e1f902015-06-03 21:57:47 -070055#
56# Neverallow Assertions
57# Additional compile time assertion checks can be added as well. The assertion
58# rules are lines beginning with the keyword neverallow. Full support for PCRE
59# regular expressions exists on all input and output selectors. Neverallow
60# rules are never output to the built seapp_contexts file. Like all keywords,
61# neverallows are case-insensitive. A neverallow is asserted when all key value
62# inputs are matched on a key value rule line.
63#
64
65# only the system server can be in system_server domain
66neverallow isSystemServer=false domain=system_server
67neverallow isSystemServer="" domain=system_server
68
69# system domains should never be assigned outside of system uid
70neverallow user=((?!system).)* domain=system_app
71neverallow user=((?!system).)* type=system_app_data_file
72
73# anything with a non-known uid with a specified name should have a specified seinfo
74neverallow user=_app name=.* seinfo=""
75neverallow user=_app name=.* seinfo=default
76
77# neverallow shared relro to any other domain
78# and neverallow any other uid into shared_relro
79neverallow user=shared_relro domain=((?!shared_relro).)*
80neverallow user=((?!shared_relro).)* domain=shared_relro
81
82# neverallow non-isolated uids into isolated_app domain
83# and vice versa
84neverallow user=_isolated domain=((?!isolated_app).)*
85neverallow user=((?!_isolated).)* domain=isolated_app
86
87# uid shell should always be in shell domain, however non-shell
88# uid's can be in shell domain
89neverallow user=shell domain=((?!shell).)*
90
Chad Brubaker06cf31e2016-10-06 13:15:44 -070091# Ephemeral Apps must run in the ephemeral_app domain
92neverallow isEphemeralApp=true domain=((?!ephemeral_app).)*
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -070093
Alex Klyubin1fdee112013-09-13 15:59:04 -070094isSystemServer=true domain=system_server
William Roberts92dfa312014-09-29 10:29:48 -070095user=system seinfo=platform domain=system_app type=system_app_data_file
96user=bluetooth seinfo=platform domain=bluetooth type=bluetooth_data_file
97user=nfc seinfo=platform domain=nfc type=nfc_data_file
98user=radio seinfo=platform domain=radio type=radio_data_file
Nick Kralevichb5ffbb72015-01-07 13:52:43 -080099user=shared_relro domain=shared_relro
William Roberts92dfa312014-09-29 10:29:48 -0700100user=shell seinfo=platform domain=shell type=shell_data_file
Stephen Smalleya8337632014-09-11 14:07:28 -0400101user=_isolated domain=isolated_app levelFrom=user
102user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user
Chad Brubaker4c40d732017-01-25 14:55:56 -0800103user=_app isEphemeralApp=true domain=ephemeral_app type=app_data_file levelFrom=all
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -0700104user=_app isPrivApp=true domain=priv_app type=app_data_file levelFrom=user
Jeff Vander Stoepbacb6d72017-02-13 13:33:27 -0800105user=_app minTargetSdkVersion=26 domain=untrusted_app type=app_data_file levelFrom=user
106user=_app domain=untrusted_app_25 type=app_data_file levelFrom=user