blob: c22c046f14a1b6fa2a35fdb8887d02d3418113bc [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)
Michael Peckf54b3622017-02-14 09:48:57 -08008# user (string)
9# seinfo (string)
10# name (string)
Michael Peckf54b3622017-02-14 09:48:57 -080011# isPrivApp (boolean)
12# minTargetSdkVersion (unsigned integer)
Yabin Cuiffa2b612018-11-02 14:34:06 -070013# fromRunAs (boolean)
Charles Chen30704922023-01-15 05:41:42 +000014# isIsolatedComputeApp (boolean)
Mugdha Lakhani49075f92023-05-07 17:41:57 +000015# isSdkSandboxNext (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.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020020# A user, or name string selector that ends in * will perform a prefix
Alan Stokes6b576bd2019-01-31 15:16:01 +000021# 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
Alan Stokes6b576bd2019-01-31 15:16:01 +000029# user=_app will match any regular app process.
30# user=_isolated will match any isolated service process.
Nikita Ioffee2da6332022-02-21 17:55:59 +000031# user=_sdksandbox will match sdk sandbox process for an app.
Alan Stokes6b576bd2019-01-31 15:16:01 +000032# 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.
Jeff Vander Stoepee9c0b52015-10-05 09:15:04 -070038# isPrivApp=true will only match for applications preinstalled in
39# /system/priv-app.
Michael Peckf54b3622017-02-14 09:48:57 -080040# minTargetSdkVersion will match applications with a targetSdkVersion
41# greater than or equal to the specified value. If unspecified,
42# it has a default value of 0.
Alan Stokes6b576bd2019-01-31 15:16:01 +000043# fromRunAs=true means the process being labeled is started by run-as. Default
44# is false.
Charles Chen30704922023-01-15 05:41:42 +000045# isIsolatedComputeApp=true means the process re-uses an isolated Uid but not
46# restricted to run in an isolated_app domain. Processes match this selector will
47# be mapped to isolated_compute_app by default. It is expected to be used together
48# with user=_isolated. This selector should not be used unless it is intended
49# to provide isolated processes with relaxed security restrictions.
Inseob Kim9d6ce192023-07-17 19:53:25 +090050# An unspecified isIsolatedComputeApp defaults to false.
Nick Kralevich4be31902014-07-01 13:59:50 -070051#
Mugdha Lakhani49075f92023-05-07 17:41:57 +000052# isSdkSandboxNext=true means sdk sandbox processes will get
53# sdk_sandbox_next sepolicy applied to them.
Inseob Kim9d6ce192023-07-17 19:53:25 +090054# An unspecified isSdkSandboxNext defaults to false.
Mugdha Lakhani49075f92023-05-07 17:41:57 +000055#
Alan Stokes6b576bd2019-01-31 15:16:01 +000056# Precedence: entries are compared using the following rules, in the order shown
57# (see external/selinux/libselinux/src/android/android_platform.c,
58# seapp_context_cmp()).
Michael Peckf54b3622017-02-14 09:48:57 -080059# (1) isSystemServer=true before isSystemServer=false.
Alan Stokes6b576bd2019-01-31 15:16:01 +000060# (2) Specified isEphemeralApp= before unspecified isEphemeralApp=
61# boolean.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020062# (3) Specified user= string before unspecified user= string;
Alan Stokes6b576bd2019-01-31 15:16:01 +000063# more specific user= string before less specific user= string.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020064# (4) Specified seinfo= string before unspecified seinfo= string.
65# (5) Specified name= string before unspecified name= string;
Alan Stokes6b576bd2019-01-31 15:16:01 +000066# more specific name= string before less specific name= string.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020067# (6) Specified isPrivApp= before unspecified isPrivApp= boolean.
68# (7) Higher value of minTargetSdkVersion= before lower value of
Alan Stokes6b576bd2019-01-31 15:16:01 +000069# minTargetSdkVersion= integer. Note that minTargetSdkVersion=
70# defaults to 0 if unspecified.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020071# (8) fromRunAs=true before fromRunAs=false.
Alan Stokes6b576bd2019-01-31 15:16:01 +000072# (A fixed selector is more specific than a prefix, i.e. ending in *, and a
73# longer prefix is more specific than a shorter prefix.)
74# Apps are checked against entries in precedence order until the first match,
75# regardless of their order in this file.
76#
77# Duplicate entries, i.e. with identical input selectors, are not allowed.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050078#
79# Outputs:
Michael Peckf54b3622017-02-14 09:48:57 -080080# domain (string)
81# type (string)
82# levelFrom (string; one of none, all, app, or user)
83# level (string)
Alan Stokes6b576bd2019-01-31 15:16:01 +000084#
85# domain= determines the label to be used for the app process; entries
86# without domain= are ignored for this purpose.
87# type= specifies the label to be used for the app data directory; entries
Alan Stokesf8ad3392020-10-27 17:35:33 +000088# without type= are ignored for this purpose. The label specified must
89# have the app_data_file_type attribute.
Alan Stokes6b576bd2019-01-31 15:16:01 +000090# levelFrom and level are used to determine the level (sensitivity + categories)
91# for MLS/MCS.
92# levelFrom=none omits the level.
93# levelFrom=app determines the level from the process UID.
94# levelFrom=user determines the level from the user ID.
95# levelFrom=all determines the level from both UID and user ID.
Nick Kralevich795add52019-04-16 15:56:33 -070096#
Stephen Smalley38084142012-11-28 10:46:18 -050097# levelFrom=user is only supported for _app or _isolated UIDs.
98# levelFrom=app or levelFrom=all is only supported for _app UIDs.
Nick Kralevich4be31902014-07-01 13:59:50 -070099# level may be used to specify a fixed level for any UID.
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500100#
Alan Stokes6b576bd2019-01-31 15:16:01 +0000101# For backwards compatibility levelFromUid=true is equivalent to levelFrom=app
102# and levelFromUid=false is equivalent to levelFrom=none.
103#
William Roberts81e1f902015-06-03 21:57:47 -0700104#
105# Neverallow Assertions
Alan Stokes6b576bd2019-01-31 15:16:01 +0000106# Additional compile time assertion checks for the rules in this file can be
107# added as well. The assertion
William Roberts81e1f902015-06-03 21:57:47 -0700108# rules are lines beginning with the keyword neverallow. Full support for PCRE
109# regular expressions exists on all input and output selectors. Neverallow
110# rules are never output to the built seapp_contexts file. Like all keywords,
111# neverallows are case-insensitive. A neverallow is asserted when all key value
112# inputs are matched on a key value rule line.
113#
114
Alan Stokes665c2952021-11-26 11:39:02 +0000115# only the system server can be assigned the system_server domains
William Roberts81e1f902015-06-03 21:57:47 -0700116neverallow isSystemServer=false domain=system_server
Alan Stokes665c2952021-11-26 11:39:02 +0000117neverallow isSystemServer=false domain=system_server_startup
William Roberts81e1f902015-06-03 21:57:47 -0700118neverallow isSystemServer="" domain=system_server
Alan Stokes665c2952021-11-26 11:39:02 +0000119neverallow isSystemServer="" domain=system_server_startup
William Roberts81e1f902015-06-03 21:57:47 -0700120
121# system domains should never be assigned outside of system uid
122neverallow user=((?!system).)* domain=system_app
123neverallow user=((?!system).)* type=system_app_data_file
124
Ashwini Oruganti04f771d2019-10-31 15:45:00 -0700125# any non priv-app with a non-known uid with a specified name should have a specified
126# seinfo
127neverallow user=_app isPrivApp=false name=.* seinfo=""
128neverallow user=_app isPrivApp=false name=.* seinfo=default
William Roberts81e1f902015-06-03 21:57:47 -0700129
130# neverallow shared relro to any other domain
131# and neverallow any other uid into shared_relro
132neverallow user=shared_relro domain=((?!shared_relro).)*
133neverallow user=((?!shared_relro).)* domain=shared_relro
134
135# neverallow non-isolated uids into isolated_app domain
136# and vice versa
Charles Chen30704922023-01-15 05:41:42 +0000137neverallow user=_isolated isIsolatedComputeApp=false domain=((?!isolated_app).)*
William Roberts81e1f902015-06-03 21:57:47 -0700138neverallow user=((?!_isolated).)* domain=isolated_app
139
Charles Chen30704922023-01-15 05:41:42 +0000140# neverallow isolatedComputeApp into domains other than isolated_compute_app
141neverallow user=_isolated isIsolatedComputeApp=true domain=((?!isolated_compute_app).)*
142
William Roberts81e1f902015-06-03 21:57:47 -0700143# uid shell should always be in shell domain, however non-shell
144# uid's can be in shell domain
145neverallow user=shell domain=((?!shell).)*
146
Max Bires77d41f72018-01-24 21:17:18 +0000147# only the package named com.android.shell can run in the shell domain
148neverallow domain=shell name=((?!com\.android\.shell).)*
149neverallow user=shell name=((?!com\.android\.shell).)*
150
Chad Brubaker06cf31e2016-10-06 13:15:44 -0700151# Ephemeral Apps must run in the ephemeral_app domain
152neverallow isEphemeralApp=true domain=((?!ephemeral_app).)*
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -0700153
Nick Kralevichcaf42d62018-10-04 10:57:29 -0700154isSystemServer=true domain=system_server_startup
155
Mugdha Lakhani2ae45c52023-04-28 09:22:15 +0000156# sdksandbox must run in an sdksandbox domain
157neverallow user=_sdksandbox domain=((?!sdk_sandbox).)*
RafayKamranf3bdc0b2021-11-03 16:08:04 +0000158
Kevin Jeon4241e002022-01-26 22:32:40 +0000159user=_app seinfo=platform name=com.android.traceur domain=traceur_app type=app_data_file levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700160user=system seinfo=platform domain=system_app type=system_app_data_file
Avichal Rakeshe0929242023-01-23 23:49:50 -0800161user=system seinfo=platform isPrivApp=true name=com.android.DeviceAsWebcam domain=device_as_webcam type=system_app_data_file levelFrom=all
Roopa Sattirajuf227d0d2022-03-28 14:39:42 -0700162user=bluetooth seinfo=bluetooth domain=bluetooth type=bluetooth_data_file
markchien48c600f2020-11-26 09:55:56 +0800163user=network_stack seinfo=network_stack domain=network_stack type=radio_data_file
William Roberts92dfa312014-09-29 10:29:48 -0700164user=nfc seinfo=platform domain=nfc type=nfc_data_file
Ruchi Kandoi8a2b4a72018-01-04 10:33:20 -0800165user=secure_element seinfo=platform domain=secure_element levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700166user=radio seinfo=platform domain=radio type=radio_data_file
Alan Stokesc7229c72020-09-24 13:46:46 +0100167user=shared_relro domain=shared_relro levelFrom=all
Max Bires77d41f72018-01-24 21:17:18 +0000168user=shell seinfo=platform domain=shell name=com.android.shell type=shell_data_file
Robert Sesekbacb19b2018-01-30 10:54:33 -0500169user=webview_zygote seinfo=webview_zygote domain=webview_zygote
Martijn Coenend40dfdc2020-06-08 20:31:33 +0200170user=_isolated domain=isolated_app levelFrom=user
Charles Chenbc965c92023-01-29 12:04:20 +0000171user=_isolated isIsolatedComputeApp=true domain=isolated_compute_app levelFrom=user
Mugdha Lakhani2ae45c52023-04-28 09:22:15 +0000172user=_sdksandbox domain=sdk_sandbox_34 type=sdk_sandbox_data_file levelFrom=all
Mugdha Lakhani49075f92023-05-07 17:41:57 +0000173user=_sdksandbox isSdkSandboxNext=true domain=sdk_sandbox_next type=sdk_sandbox_data_file levelFrom=all
Martijn Coenend40dfdc2020-06-08 20:31:33 +0200174user=_app seinfo=app_zygote domain=app_zygote levelFrom=user
Jeff Vander Stoepfcf12fd2020-04-22 15:26:02 +0200175user=_app seinfo=media domain=mediaprovider type=app_data_file levelFrom=user
Stephen Smalleya8337632014-09-11 14:07:28 -0400176user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user
Nick Kralevich795add52019-04-16 15:56:33 -0700177user=_app isEphemeralApp=true domain=ephemeral_app type=app_data_file levelFrom=all
Nick Kralevich5d175512018-09-12 12:30:32 -0700178user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user
Ashwini Oruganti04f771d2019-10-31 15:45:00 -0700179user=_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 +0200180user=_app seinfo=media isPrivApp=true name=com.android.providers.media.module domain=mediaprovider_app type=privapp_data_file levelFrom=all
Krishang Garodiacaf79842023-02-09 17:31:47 +0000181user=_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 +0100182user=_app isPrivApp=true name=com.google.android.providers.media.module domain=mediaprovider_app type=privapp_data_file levelFrom=all
Krishang Garodiacaf79842023-02-09 17:31:47 +0000183user=_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 -0700184user=_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 -0800185user=_app isPrivApp=true name=com.android.vzwomatrigger domain=vzwomatrigger_app type=privapp_data_file levelFrom=all
Alan Stokes12de1842023-06-08 11:24:56 +0100186user=_app isPrivApp=true name=com.android.rkpdapp domain=rkpdapp type=privapp_data_file levelFrom=all
187user=_app isPrivApp=true name=com.google.android.rkpdapp domain=rkpdapp type=privapp_data_file levelFrom=all
Ashwini Orugantic46a7bc2019-10-29 14:13:20 -0700188user=_app isPrivApp=true name=com.google.android.gms domain=gmscore_app type=privapp_data_file levelFrom=user
189user=_app isPrivApp=true name=com.google.android.gms.* domain=gmscore_app type=privapp_data_file levelFrom=user
190user=_app isPrivApp=true name=com.google.android.gms:* domain=gmscore_app type=privapp_data_file levelFrom=user
Ashwini Orugantiefc3bdb2020-04-22 10:22:45 -0700191user=_app isPrivApp=true name=com.google.android.gsf domain=gmscore_app type=privapp_data_file levelFrom=user
Yuyang Huangcfdea5f2023-01-18 16:52:43 +0900192user=_app minTargetSdkVersion=34 domain=untrusted_app type=app_data_file levelFrom=all
193user=_app minTargetSdkVersion=32 domain=untrusted_app_32 type=app_data_file levelFrom=all
Bram Bonnéea5460a2021-05-12 14:19:24 +0200194user=_app minTargetSdkVersion=30 domain=untrusted_app_30 type=app_data_file levelFrom=all
Jeff Vander Stoep1f7ae8e2020-01-20 10:14:48 +0100195user=_app minTargetSdkVersion=29 domain=untrusted_app_29 type=app_data_file levelFrom=all
Yabin Cui5dc2c8c2018-11-02 11:12:43 -0700196user=_app minTargetSdkVersion=28 domain=untrusted_app_27 type=app_data_file levelFrom=all
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800197user=_app minTargetSdkVersion=26 domain=untrusted_app_27 type=app_data_file levelFrom=user
Jeff Vander Stoepbacb6d72017-02-13 13:33:27 -0800198user=_app domain=untrusted_app_25 type=app_data_file levelFrom=user
Yabin Cui770a4f62019-01-07 16:37:24 -0800199user=_app minTargetSdkVersion=28 fromRunAs=true domain=runas_app levelFrom=all
200user=_app fromRunAs=true domain=runas_app levelFrom=user