blob: 6349a97f98aff7e8310062a65a9992ae7c66dd5e [file] [log] [blame]
Nick Kralevich4be31902014-07-01 13:59:50 -07001# Input selectors:
Stephen Smalley2dd4e512012-01-04 12:33:27 -05002# isSystemServer (boolean)
Chad Brubaker06cf31e2016-10-06 13:15:44 -07003# isEphemeralApp (boolean)
Stephen Smalleyff4db912014-09-15 15:16:06 -04004# isOwner (boolean)
Stephen Smalley2dd4e512012-01-04 12:33:27 -05005# user (string)
6# seinfo (string)
7# name (string)
Stephen Smalley6139de52014-02-19 10:54:41 -05008# path (string)
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -07009# isPrivApp (boolean)
Stephen Smalley2dd4e512012-01-04 12:33:27 -050010# isSystemServer=true can only be used once.
Stephen Smalleydd31ddf2012-07-27 17:08:21 -040011# An unspecified isSystemServer defaults to false.
Chad Brubaker06cf31e2016-10-06 13:15:44 -070012# isEphemeralApp=true will match apps marked by PackageManager as Ephemeral
Stephen Smalleyff4db912014-09-15 15:16:06 -040013# isOwner=true will only match for the owner/primary user.
14# isOwner=false will only match for secondary users.
15# If unspecified, the entry can match either case.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050016# An unspecified string selector will match any value.
17# A user string selector that ends in * will perform a prefix match.
Stephen Smalley3ac1d262012-09-24 10:16:03 -040018# user=_app will match any regular app UID.
19# user=_isolated will match any isolated service UID.
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -070020# isPrivApp=true will only match for applications preinstalled in
21# /system/priv-app.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050022# All specified input selectors in an entry must match (i.e. logical AND).
23# Matching is case-insensitive.
Nick Kralevich4be31902014-07-01 13:59:50 -070024#
Stephen Smalley2dd4e512012-01-04 12:33:27 -050025# Precedence rules:
26# (1) isSystemServer=true before isSystemServer=false.
Chad Brubaker06cf31e2016-10-06 13:15:44 -070027# (2) Specified isEphemeralApp= before unspecified isEphemeralApp= boolean.
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -070028# (3) Specified isOwner= before unspecified isOwner= boolean.
29# (4) Specified user= string before unspecified user= string.
30# (5) Fixed user= string before user= prefix (i.e. ending in *).
31# (6) Longer user= prefix before shorter user= prefix.
32# (7) Specified seinfo= string before unspecified seinfo= string.
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -070033# ':' character is reserved and may not be used.
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -070034# (8) Specified name= string before unspecified name= string.
35# (9) Specified path= string before unspecified path= string.
36# (10) Specified isPrivApp= before unspecified isPrivApp= boolean.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050037#
38# Outputs:
39# domain (string)
40# type (string)
Stephen Smalley38084142012-11-28 10:46:18 -050041# levelFrom (string; one of none, all, app, or user)
Stephen Smalley2dd4e512012-01-04 12:33:27 -050042# level (string)
43# Only entries that specify domain= will be used for app process labeling.
44# Only entries that specify type= will be used for app directory labeling.
Stephen Smalley38084142012-11-28 10:46:18 -050045# levelFrom=user is only supported for _app or _isolated UIDs.
46# levelFrom=app or levelFrom=all is only supported for _app UIDs.
Nick Kralevich4be31902014-07-01 13:59:50 -070047# level may be used to specify a fixed level for any UID.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050048#
William Roberts81e1f902015-06-03 21:57:47 -070049#
50# Neverallow Assertions
51# Additional compile time assertion checks can be added as well. The assertion
52# rules are lines beginning with the keyword neverallow. Full support for PCRE
53# regular expressions exists on all input and output selectors. Neverallow
54# rules are never output to the built seapp_contexts file. Like all keywords,
55# neverallows are case-insensitive. A neverallow is asserted when all key value
56# inputs are matched on a key value rule line.
57#
58
59# only the system server can be in system_server domain
60neverallow isSystemServer=false domain=system_server
61neverallow isSystemServer="" domain=system_server
62
63# system domains should never be assigned outside of system uid
64neverallow user=((?!system).)* domain=system_app
65neverallow user=((?!system).)* type=system_app_data_file
66
67# anything with a non-known uid with a specified name should have a specified seinfo
68neverallow user=_app name=.* seinfo=""
69neverallow user=_app name=.* seinfo=default
70
71# neverallow shared relro to any other domain
72# and neverallow any other uid into shared_relro
73neverallow user=shared_relro domain=((?!shared_relro).)*
74neverallow user=((?!shared_relro).)* domain=shared_relro
75
76# neverallow non-isolated uids into isolated_app domain
77# and vice versa
78neverallow user=_isolated domain=((?!isolated_app).)*
79neverallow user=((?!_isolated).)* domain=isolated_app
80
81# uid shell should always be in shell domain, however non-shell
82# uid's can be in shell domain
83neverallow user=shell domain=((?!shell).)*
84
Chad Brubaker06cf31e2016-10-06 13:15:44 -070085# Ephemeral Apps must run in the ephemeral_app domain
86neverallow isEphemeralApp=true domain=((?!ephemeral_app).)*
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -070087
Alex Klyubin1fdee112013-09-13 15:59:04 -070088isSystemServer=true domain=system_server
William Roberts92dfa312014-09-29 10:29:48 -070089user=system seinfo=platform domain=system_app type=system_app_data_file
90user=bluetooth seinfo=platform domain=bluetooth type=bluetooth_data_file
91user=nfc seinfo=platform domain=nfc type=nfc_data_file
92user=radio seinfo=platform domain=radio type=radio_data_file
Nick Kralevichb5ffbb72015-01-07 13:52:43 -080093user=shared_relro domain=shared_relro
William Roberts92dfa312014-09-29 10:29:48 -070094user=shell seinfo=platform domain=shell type=shell_data_file
Stephen Smalleya8337632014-09-11 14:07:28 -040095user=_isolated domain=isolated_app levelFrom=user
96user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user
Chad Brubaker06cf31e2016-10-06 13:15:44 -070097user=_app isEphemeralApp=true domain=ephemeral_app type=ephemeral_data_file levelFrom=all
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -070098user=_app isPrivApp=true domain=priv_app type=app_data_file levelFrom=user
Stephen Smalleya8337632014-09-11 14:07:28 -040099user=_app domain=untrusted_app type=app_data_file levelFrom=user