blob: 929f073412145515dd5c36be436e239fb7f02701 [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)
8# isOwner (boolean)
9# user (string)
10# seinfo (string)
11# name (string)
12# path (string)
13# isPrivApp (boolean)
14# minTargetSdkVersion (unsigned integer)
Yabin Cuiffa2b612018-11-02 14:34:06 -070015# fromRunAs (boolean)
Alan Stokes6b576bd2019-01-31 15:16:01 +000016#
17# All specified input selectors in an entry must match (i.e. logical AND).
18# An unspecified string or boolean selector with no default will match any
19# value.
20# A user, name, or path string selector that ends in * will perform a prefix
21# match.
22# String matching is case-insensitive.
23# See external/selinux/libselinux/src/android/android_platform.c,
24# seapp_context_lookup().
25#
26# isSystemServer=true only matches the system server.
Stephen Smalleydd31ddf2012-07-27 17:08:21 -040027# An unspecified isSystemServer defaults to false.
Chad Brubaker06cf31e2016-10-06 13:15:44 -070028# isEphemeralApp=true will match apps marked by PackageManager as Ephemeral
Stephen Smalleyff4db912014-09-15 15:16:06 -040029# isOwner=true will only match for the owner/primary user.
Alan Stokes6b576bd2019-01-31 15:16:01 +000030# user=_app will match any regular app process.
31# user=_isolated will match any isolated service process.
32# Other values of user are matched against the name associated with the process
33# UID.
34# seinfo= matches aginst the seinfo tag for the app, determined from
35# mac_permissions.xml files.
36# The ':' character is reserved and may not be used in seinfo.
37# name= matches against the package name of the app.
38# path= matches against the directory path when labeling app directories.
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -070039# isPrivApp=true will only match for applications preinstalled in
40# /system/priv-app.
Michael Peckf54b3622017-02-14 09:48:57 -080041# minTargetSdkVersion will match applications with a targetSdkVersion
42# greater than or equal to the specified value. If unspecified,
43# it has a default value of 0.
Alan Stokes6b576bd2019-01-31 15:16:01 +000044# fromRunAs=true means the process being labeled is started by run-as. Default
45# is false.
Nick Kralevich4be31902014-07-01 13:59:50 -070046#
Alan Stokes6b576bd2019-01-31 15:16:01 +000047# Precedence: entries are compared using the following rules, in the order shown
48# (see external/selinux/libselinux/src/android/android_platform.c,
49# seapp_context_cmp()).
Michael Peckf54b3622017-02-14 09:48:57 -080050# (1) isSystemServer=true before isSystemServer=false.
Alan Stokes6b576bd2019-01-31 15:16:01 +000051# (2) Specified isEphemeralApp= before unspecified isEphemeralApp=
52# boolean.
Nick Kralevich795add52019-04-16 15:56:33 -070053# (3) Specified isOwner= before unspecified isOwner= boolean.
54# (4) Specified user= string before unspecified user= string;
Alan Stokes6b576bd2019-01-31 15:16:01 +000055# more specific user= string before less specific user= string.
Nick Kralevich795add52019-04-16 15:56:33 -070056# (5) Specified seinfo= string before unspecified seinfo= string.
57# (6) Specified name= string before unspecified name= string;
Alan Stokes6b576bd2019-01-31 15:16:01 +000058# more specific name= string before less specific name= string.
Nick Kralevich795add52019-04-16 15:56:33 -070059# (7) Specified path= string before unspecified path= string.
Alan Stokes6b576bd2019-01-31 15:16:01 +000060# more specific name= string before less specific name= string.
Nick Kralevich795add52019-04-16 15:56:33 -070061# (8) Specified isPrivApp= before unspecified isPrivApp= boolean.
62# (9) Higher value of minTargetSdkVersion= before lower value of
Alan Stokes6b576bd2019-01-31 15:16:01 +000063# minTargetSdkVersion= integer. Note that minTargetSdkVersion=
64# defaults to 0 if unspecified.
Nick Kralevich795add52019-04-16 15:56:33 -070065# (10) fromRunAs=true before fromRunAs=false.
Alan Stokes6b576bd2019-01-31 15:16:01 +000066# (A fixed selector is more specific than a prefix, i.e. ending in *, and a
67# longer prefix is more specific than a shorter prefix.)
68# Apps are checked against entries in precedence order until the first match,
69# regardless of their order in this file.
70#
71# Duplicate entries, i.e. with identical input selectors, are not allowed.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050072#
73# Outputs:
Michael Peckf54b3622017-02-14 09:48:57 -080074# domain (string)
75# type (string)
76# levelFrom (string; one of none, all, app, or user)
77# level (string)
Alan Stokes6b576bd2019-01-31 15:16:01 +000078#
79# domain= determines the label to be used for the app process; entries
80# without domain= are ignored for this purpose.
81# type= specifies the label to be used for the app data directory; entries
Alan Stokesf8ad3392020-10-27 17:35:33 +000082# without type= are ignored for this purpose. The label specified must
83# have the app_data_file_type attribute.
Alan Stokes6b576bd2019-01-31 15:16:01 +000084# levelFrom and level are used to determine the level (sensitivity + categories)
85# for MLS/MCS.
86# levelFrom=none omits the level.
87# levelFrom=app determines the level from the process UID.
88# levelFrom=user determines the level from the user ID.
89# levelFrom=all determines the level from both UID and user ID.
Nick Kralevich795add52019-04-16 15:56:33 -070090#
Stephen Smalley38084142012-11-28 10:46:18 -050091# levelFrom=user is only supported for _app or _isolated UIDs.
92# levelFrom=app or levelFrom=all is only supported for _app UIDs.
Nick Kralevich4be31902014-07-01 13:59:50 -070093# level may be used to specify a fixed level for any UID.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050094#
Alan Stokes6b576bd2019-01-31 15:16:01 +000095# For backwards compatibility levelFromUid=true is equivalent to levelFrom=app
96# and levelFromUid=false is equivalent to levelFrom=none.
97#
William Roberts81e1f902015-06-03 21:57:47 -070098#
99# Neverallow Assertions
Alan Stokes6b576bd2019-01-31 15:16:01 +0000100# Additional compile time assertion checks for the rules in this file can be
101# added as well. The assertion
William Roberts81e1f902015-06-03 21:57:47 -0700102# rules are lines beginning with the keyword neverallow. Full support for PCRE
103# regular expressions exists on all input and output selectors. Neverallow
104# rules are never output to the built seapp_contexts file. Like all keywords,
105# neverallows are case-insensitive. A neverallow is asserted when all key value
106# inputs are matched on a key value rule line.
107#
108
109# only the system server can be in system_server domain
110neverallow isSystemServer=false domain=system_server
111neverallow isSystemServer="" domain=system_server
112
113# system domains should never be assigned outside of system uid
114neverallow user=((?!system).)* domain=system_app
115neverallow user=((?!system).)* type=system_app_data_file
116
Ashwini Oruganti04f771d2019-10-31 15:45:00 -0700117# any non priv-app with a non-known uid with a specified name should have a specified
118# seinfo
119neverallow user=_app isPrivApp=false name=.* seinfo=""
120neverallow user=_app isPrivApp=false name=.* seinfo=default
William Roberts81e1f902015-06-03 21:57:47 -0700121
122# neverallow shared relro to any other domain
123# and neverallow any other uid into shared_relro
124neverallow user=shared_relro domain=((?!shared_relro).)*
125neverallow user=((?!shared_relro).)* domain=shared_relro
126
127# neverallow non-isolated uids into isolated_app domain
128# and vice versa
129neverallow user=_isolated domain=((?!isolated_app).)*
130neverallow user=((?!_isolated).)* domain=isolated_app
131
132# uid shell should always be in shell domain, however non-shell
133# uid's can be in shell domain
134neverallow user=shell domain=((?!shell).)*
135
Max Bires77d41f72018-01-24 21:17:18 +0000136# only the package named com.android.shell can run in the shell domain
137neverallow domain=shell name=((?!com\.android\.shell).)*
138neverallow user=shell name=((?!com\.android\.shell).)*
139
Chad Brubaker06cf31e2016-10-06 13:15:44 -0700140# Ephemeral Apps must run in the ephemeral_app domain
141neverallow isEphemeralApp=true domain=((?!ephemeral_app).)*
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -0700142
Nick Kralevichcaf42d62018-10-04 10:57:29 -0700143isSystemServer=true domain=system_server_startup
144
Collin Fijalkovich057c7d62020-08-28 16:10:36 -0700145user=_app isPrivApp=true name=com.android.traceur domain=traceur_app type=app_data_file levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700146user=system seinfo=platform domain=system_app type=system_app_data_file
147user=bluetooth seinfo=platform domain=bluetooth type=bluetooth_data_file
markchien48c600f2020-11-26 09:55:56 +0800148user=network_stack seinfo=network_stack domain=network_stack type=radio_data_file
William Roberts92dfa312014-09-29 10:29:48 -0700149user=nfc seinfo=platform domain=nfc type=nfc_data_file
Ruchi Kandoi8a2b4a72018-01-04 10:33:20 -0800150user=secure_element seinfo=platform domain=secure_element levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700151user=radio seinfo=platform domain=radio type=radio_data_file
Alan Stokesc7229c72020-09-24 13:46:46 +0100152user=shared_relro domain=shared_relro levelFrom=all
Max Bires77d41f72018-01-24 21:17:18 +0000153user=shell seinfo=platform domain=shell name=com.android.shell type=shell_data_file
Robert Sesekbacb19b2018-01-30 10:54:33 -0500154user=webview_zygote seinfo=webview_zygote domain=webview_zygote
Martijn Coenend40dfdc2020-06-08 20:31:33 +0200155user=_isolated domain=isolated_app levelFrom=user
156user=_app seinfo=app_zygote domain=app_zygote levelFrom=user
Jeff Vander Stoepfcf12fd2020-04-22 15:26:02 +0200157user=_app seinfo=media domain=mediaprovider type=app_data_file levelFrom=user
Stephen Smalleya8337632014-09-11 14:07:28 -0400158user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user
Nick Kralevich795add52019-04-16 15:56:33 -0700159user=_app isEphemeralApp=true domain=ephemeral_app type=app_data_file levelFrom=all
Jeff Vander Stoep4e7769e2020-05-06 13:17:28 +0200160user=_app minTargetSdkVersion=31 isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=all
Nick Kralevich5d175512018-09-12 12:30:32 -0700161user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user
Ashwini Oruganti04f771d2019-10-31 15:45:00 -0700162user=_app isPrivApp=true name=com.google.android.permissioncontroller domain=permissioncontroller_app type=privapp_data_file levelFrom=all
Jeff Vander Stoepfcf12fd2020-04-22 15:26:02 +0200163user=_app seinfo=media isPrivApp=true name=com.android.providers.media.module domain=mediaprovider_app type=privapp_data_file levelFrom=all
Martijn Coenene3f1d5a2020-01-30 16:52:45 +0100164user=_app isPrivApp=true name=com.google.android.providers.media.module domain=mediaprovider_app type=privapp_data_file levelFrom=all
Ashwini Orugantib3bffe82020-06-15 11:14:04 -0700165user=_app seinfo=platform isPrivApp=true name=com.android.permissioncontroller domain=permissioncontroller_app type=privapp_data_file levelFrom=all
Ashwini Orugantic77ff372019-11-14 14:00:30 -0800166user=_app isPrivApp=true name=com.android.vzwomatrigger domain=vzwomatrigger_app type=privapp_data_file levelFrom=all
Ashwini Orugantic46a7bc2019-10-29 14:13:20 -0700167user=_app isPrivApp=true name=com.google.android.gms domain=gmscore_app type=privapp_data_file levelFrom=user
168user=_app isPrivApp=true name=com.google.android.gms.* domain=gmscore_app type=privapp_data_file levelFrom=user
169user=_app isPrivApp=true name=com.google.android.gms:* domain=gmscore_app type=privapp_data_file levelFrom=user
Ashwini Orugantiefc3bdb2020-04-22 10:22:45 -0700170user=_app isPrivApp=true name=com.google.android.gsf domain=gmscore_app type=privapp_data_file levelFrom=user
Jeff Vander Stoep1f7ae8e2020-01-20 10:14:48 +0100171user=_app minTargetSdkVersion=30 domain=untrusted_app type=app_data_file levelFrom=all
172user=_app minTargetSdkVersion=29 domain=untrusted_app_29 type=app_data_file levelFrom=all
Yabin Cui5dc2c8c2018-11-02 11:12:43 -0700173user=_app minTargetSdkVersion=28 domain=untrusted_app_27 type=app_data_file levelFrom=all
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800174user=_app minTargetSdkVersion=26 domain=untrusted_app_27 type=app_data_file levelFrom=user
Jeff Vander Stoepbacb6d72017-02-13 13:33:27 -0800175user=_app domain=untrusted_app_25 type=app_data_file levelFrom=user
Yabin Cui770a4f62019-01-07 16:37:24 -0800176user=_app minTargetSdkVersion=28 fromRunAs=true domain=runas_app levelFrom=all
177user=_app fromRunAs=true domain=runas_app levelFrom=user