blob: 74701df7da4b7b3d934f94b834f8b79b0435ccb6 [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)
Sandro Montanari4db0e272023-10-19 15:00:55 +000016# isSdkSandboxAudit (boolean)
Alan Stokes6b576bd2019-01-31 15:16:01 +000017#
18# All specified input selectors in an entry must match (i.e. logical AND).
19# An unspecified string or boolean selector with no default will match any
20# value.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020021# A user, or name string selector that ends in * will perform a prefix
Alan Stokes6b576bd2019-01-31 15:16:01 +000022# match.
23# String matching is case-insensitive.
24# See external/selinux/libselinux/src/android/android_platform.c,
25# seapp_context_lookup().
26#
27# isSystemServer=true only matches the system server.
Stephen Smalleydd31ddf2012-07-27 17:08:21 -040028# An unspecified isSystemServer defaults to false.
Chad Brubaker06cf31e2016-10-06 13:15:44 -070029# isEphemeralApp=true will match apps marked by PackageManager as Ephemeral
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.
Nikita Ioffee2da6332022-02-21 17:55:59 +000032# user=_sdksandbox will match sdk sandbox process for an app.
Alan Stokes6b576bd2019-01-31 15:16:01 +000033# Other values of user are matched against the name associated with the process
34# UID.
35# seinfo= matches aginst the seinfo tag for the app, determined from
36# mac_permissions.xml files.
37# The ':' character is reserved and may not be used in seinfo.
38# name= matches against the package name of the app.
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.
Charles Chen30704922023-01-15 05:41:42 +000046# isIsolatedComputeApp=true means the process re-uses an isolated Uid but not
47# restricted to run in an isolated_app domain. Processes match this selector will
48# be mapped to isolated_compute_app by default. It is expected to be used together
49# with user=_isolated. This selector should not be used unless it is intended
50# to provide isolated processes with relaxed security restrictions.
Inseob Kim9d6ce192023-07-17 19:53:25 +090051# An unspecified isIsolatedComputeApp defaults to false.
Nick Kralevich4be31902014-07-01 13:59:50 -070052#
Sandro Montanari4db0e272023-10-19 15:00:55 +000053# The sdk_sandbox_next and sdk_sandbox_audit domains are special domains for the
54# SDK sandbox process. sdk_sandbox_next defines the set of restrictions proposed
55# for the upcoming dessert release. sdk_sandbox_audit uses the same restrictions
56# as the current dessert release, with additional auditing rules for the accesses
57# we are considering forbidding in the upcoming release.
58#
Mugdha Lakhani49075f92023-05-07 17:41:57 +000059# isSdkSandboxNext=true means sdk sandbox processes will get
60# sdk_sandbox_next sepolicy applied to them.
Inseob Kim9d6ce192023-07-17 19:53:25 +090061# An unspecified isSdkSandboxNext defaults to false.
Mugdha Lakhani49075f92023-05-07 17:41:57 +000062#
Sandro Montanari4db0e272023-10-19 15:00:55 +000063# isSdkSandboxAudit=true means sdk sandbox processes will get
64# sdk_sandbox_audit sepolicy applied to them.
65# An unspecified isSdkSandboxAudit defaults to false.
66#
Alan Stokes6b576bd2019-01-31 15:16:01 +000067# Precedence: entries are compared using the following rules, in the order shown
68# (see external/selinux/libselinux/src/android/android_platform.c,
69# seapp_context_cmp()).
Michael Peckf54b3622017-02-14 09:48:57 -080070# (1) isSystemServer=true before isSystemServer=false.
Alan Stokes6b576bd2019-01-31 15:16:01 +000071# (2) Specified isEphemeralApp= before unspecified isEphemeralApp=
72# boolean.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020073# (3) Specified user= string before unspecified user= string;
Alan Stokes6b576bd2019-01-31 15:16:01 +000074# more specific user= string before less specific user= string.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020075# (4) Specified seinfo= string before unspecified seinfo= string.
76# (5) Specified name= string before unspecified name= string;
Alan Stokes6b576bd2019-01-31 15:16:01 +000077# more specific name= string before less specific name= string.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020078# (6) Specified isPrivApp= before unspecified isPrivApp= boolean.
79# (7) Higher value of minTargetSdkVersion= before lower value of
Alan Stokes6b576bd2019-01-31 15:16:01 +000080# minTargetSdkVersion= integer. Note that minTargetSdkVersion=
81# defaults to 0 if unspecified.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020082# (8) fromRunAs=true before fromRunAs=false.
Inseob Kim7bb1b5d2023-07-21 18:20:10 +090083# (9) Platform seapp_contexts files (system, system_ext, product) before
84# vendor seapp_contexts files (vendor, odm).
Alan Stokes6b576bd2019-01-31 15:16:01 +000085# (A fixed selector is more specific than a prefix, i.e. ending in *, and a
86# longer prefix is more specific than a shorter prefix.)
87# Apps are checked against entries in precedence order until the first match,
88# regardless of their order in this file.
89#
90# Duplicate entries, i.e. with identical input selectors, are not allowed.
Stephen Smalley2dd4e512012-01-04 12:33:27 -050091#
92# Outputs:
Michael Peckf54b3622017-02-14 09:48:57 -080093# domain (string)
94# type (string)
95# levelFrom (string; one of none, all, app, or user)
96# level (string)
Alan Stokes6b576bd2019-01-31 15:16:01 +000097#
98# domain= determines the label to be used for the app process; entries
99# without domain= are ignored for this purpose.
100# type= specifies the label to be used for the app data directory; entries
Alan Stokesf8ad3392020-10-27 17:35:33 +0000101# without type= are ignored for this purpose. The label specified must
102# have the app_data_file_type attribute.
Alan Stokes6b576bd2019-01-31 15:16:01 +0000103# levelFrom and level are used to determine the level (sensitivity + categories)
104# for MLS/MCS.
105# levelFrom=none omits the level.
106# levelFrom=app determines the level from the process UID.
107# levelFrom=user determines the level from the user ID.
108# levelFrom=all determines the level from both UID and user ID.
Nick Kralevich795add52019-04-16 15:56:33 -0700109#
Stephen Smalley38084142012-11-28 10:46:18 -0500110# levelFrom=user is only supported for _app or _isolated UIDs.
111# levelFrom=app or levelFrom=all is only supported for _app UIDs.
Nick Kralevich4be31902014-07-01 13:59:50 -0700112# level may be used to specify a fixed level for any UID.
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500113#
Alan Stokes6b576bd2019-01-31 15:16:01 +0000114# For backwards compatibility levelFromUid=true is equivalent to levelFrom=app
115# and levelFromUid=false is equivalent to levelFrom=none.
116#
William Roberts81e1f902015-06-03 21:57:47 -0700117#
118# Neverallow Assertions
Alan Stokes6b576bd2019-01-31 15:16:01 +0000119# Additional compile time assertion checks for the rules in this file can be
120# added as well. The assertion
William Roberts81e1f902015-06-03 21:57:47 -0700121# rules are lines beginning with the keyword neverallow. Full support for PCRE
122# regular expressions exists on all input and output selectors. Neverallow
123# rules are never output to the built seapp_contexts file. Like all keywords,
124# neverallows are case-insensitive. A neverallow is asserted when all key value
125# inputs are matched on a key value rule line.
126#
127
Alan Stokes665c2952021-11-26 11:39:02 +0000128# only the system server can be assigned the system_server domains
William Roberts81e1f902015-06-03 21:57:47 -0700129neverallow isSystemServer=false domain=system_server
Alan Stokes665c2952021-11-26 11:39:02 +0000130neverallow isSystemServer=false domain=system_server_startup
William Roberts81e1f902015-06-03 21:57:47 -0700131neverallow isSystemServer="" domain=system_server
Alan Stokes665c2952021-11-26 11:39:02 +0000132neverallow isSystemServer="" domain=system_server_startup
William Roberts81e1f902015-06-03 21:57:47 -0700133
134# system domains should never be assigned outside of system uid
135neverallow user=((?!system).)* domain=system_app
136neverallow user=((?!system).)* type=system_app_data_file
137
Ashwini Oruganti04f771d2019-10-31 15:45:00 -0700138# any non priv-app with a non-known uid with a specified name should have a specified
139# seinfo
140neverallow user=_app isPrivApp=false name=.* seinfo=""
141neverallow user=_app isPrivApp=false name=.* seinfo=default
William Roberts81e1f902015-06-03 21:57:47 -0700142
143# neverallow shared relro to any other domain
144# and neverallow any other uid into shared_relro
145neverallow user=shared_relro domain=((?!shared_relro).)*
146neverallow user=((?!shared_relro).)* domain=shared_relro
147
148# neverallow non-isolated uids into isolated_app domain
149# and vice versa
Charles Chen30704922023-01-15 05:41:42 +0000150neverallow user=_isolated isIsolatedComputeApp=false domain=((?!isolated_app).)*
William Roberts81e1f902015-06-03 21:57:47 -0700151neverallow user=((?!_isolated).)* domain=isolated_app
152
Charles Chen30704922023-01-15 05:41:42 +0000153# neverallow isolatedComputeApp into domains other than isolated_compute_app
154neverallow user=_isolated isIsolatedComputeApp=true domain=((?!isolated_compute_app).)*
155
William Roberts81e1f902015-06-03 21:57:47 -0700156# uid shell should always be in shell domain, however non-shell
157# uid's can be in shell domain
158neverallow user=shell domain=((?!shell).)*
159
Max Bires77d41f72018-01-24 21:17:18 +0000160# only the package named com.android.shell can run in the shell domain
161neverallow domain=shell name=((?!com\.android\.shell).)*
162neverallow user=shell name=((?!com\.android\.shell).)*
163
Chad Brubaker06cf31e2016-10-06 13:15:44 -0700164# Ephemeral Apps must run in the ephemeral_app domain
165neverallow isEphemeralApp=true domain=((?!ephemeral_app).)*
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -0700166
Nick Kralevichcaf42d62018-10-04 10:57:29 -0700167isSystemServer=true domain=system_server_startup
168
Mugdha Lakhani2ae45c52023-04-28 09:22:15 +0000169# sdksandbox must run in an sdksandbox domain
170neverallow user=_sdksandbox domain=((?!sdk_sandbox).)*
RafayKamranf3bdc0b2021-11-03 16:08:04 +0000171
Kevin Jeon4241e002022-01-26 22:32:40 +0000172user=_app seinfo=platform name=com.android.traceur domain=traceur_app type=app_data_file levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700173user=system seinfo=platform domain=system_app type=system_app_data_file
Avichal Rakeshe0929242023-01-23 23:49:50 -0800174user=system seinfo=platform isPrivApp=true name=com.android.DeviceAsWebcam domain=device_as_webcam type=system_app_data_file levelFrom=all
Vadim Caend64cf752022-11-04 12:51:18 +0000175user=system seinfo=platform isPrivApp=true name=com.android.virtualcamera domain=virtual_camera type=app_data_file levelFrom=all
Roopa Sattirajuf227d0d2022-03-28 14:39:42 -0700176user=bluetooth seinfo=bluetooth domain=bluetooth type=bluetooth_data_file
markchien48c600f2020-11-26 09:55:56 +0800177user=network_stack seinfo=network_stack domain=network_stack type=radio_data_file
William Roberts92dfa312014-09-29 10:29:48 -0700178user=nfc seinfo=platform domain=nfc type=nfc_data_file
Ruchi Kandoi8a2b4a72018-01-04 10:33:20 -0800179user=secure_element seinfo=platform domain=secure_element levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700180user=radio seinfo=platform domain=radio type=radio_data_file
Alan Stokesc7229c72020-09-24 13:46:46 +0100181user=shared_relro domain=shared_relro levelFrom=all
Max Bires77d41f72018-01-24 21:17:18 +0000182user=shell seinfo=platform domain=shell name=com.android.shell type=shell_data_file
Robert Sesekbacb19b2018-01-30 10:54:33 -0500183user=webview_zygote seinfo=webview_zygote domain=webview_zygote
Martijn Coenend40dfdc2020-06-08 20:31:33 +0200184user=_isolated domain=isolated_app levelFrom=user
Charles Chenbc965c92023-01-29 12:04:20 +0000185user=_isolated isIsolatedComputeApp=true domain=isolated_compute_app levelFrom=user
Mugdha Lakhani2ae45c52023-04-28 09:22:15 +0000186user=_sdksandbox domain=sdk_sandbox_34 type=sdk_sandbox_data_file levelFrom=all
Mugdha Lakhani49075f92023-05-07 17:41:57 +0000187user=_sdksandbox isSdkSandboxNext=true domain=sdk_sandbox_next type=sdk_sandbox_data_file levelFrom=all
Sandro Montanari4db0e272023-10-19 15:00:55 +0000188user=_sdksandbox isSdkSandboxAudit=true domain=sdk_sandbox_audit type=sdk_sandbox_data_file levelFrom=all
Martijn Coenend40dfdc2020-06-08 20:31:33 +0200189user=_app seinfo=app_zygote domain=app_zygote levelFrom=user
Jeff Vander Stoepfcf12fd2020-04-22 15:26:02 +0200190user=_app seinfo=media domain=mediaprovider type=app_data_file levelFrom=user
Stephen Smalleya8337632014-09-11 14:07:28 -0400191user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user
Nick Kralevich795add52019-04-16 15:56:33 -0700192user=_app isEphemeralApp=true domain=ephemeral_app type=app_data_file levelFrom=all
Nick Kralevich5d175512018-09-12 12:30:32 -0700193user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user
Ashwini Oruganti04f771d2019-10-31 15:45:00 -0700194user=_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 +0200195user=_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 +0000196user=_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 +0100197user=_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 +0000198user=_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 -0700199user=_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 -0800200user=_app isPrivApp=true name=com.android.vzwomatrigger domain=vzwomatrigger_app type=privapp_data_file levelFrom=all
Alan Stokes12de1842023-06-08 11:24:56 +0100201user=_app isPrivApp=true name=com.android.rkpdapp domain=rkpdapp type=privapp_data_file levelFrom=all
202user=_app isPrivApp=true name=com.google.android.rkpdapp domain=rkpdapp type=privapp_data_file levelFrom=all
Ashwini Orugantic46a7bc2019-10-29 14:13:20 -0700203user=_app isPrivApp=true name=com.google.android.gms domain=gmscore_app type=privapp_data_file levelFrom=user
204user=_app isPrivApp=true name=com.google.android.gms.* domain=gmscore_app type=privapp_data_file levelFrom=user
205user=_app isPrivApp=true name=com.google.android.gms:* domain=gmscore_app type=privapp_data_file levelFrom=user
Ashwini Orugantiefc3bdb2020-04-22 10:22:45 -0700206user=_app isPrivApp=true name=com.google.android.gsf domain=gmscore_app type=privapp_data_file levelFrom=user
Yuyang Huangcfdea5f2023-01-18 16:52:43 +0900207user=_app minTargetSdkVersion=34 domain=untrusted_app type=app_data_file levelFrom=all
208user=_app minTargetSdkVersion=32 domain=untrusted_app_32 type=app_data_file levelFrom=all
Bram Bonnéea5460a2021-05-12 14:19:24 +0200209user=_app minTargetSdkVersion=30 domain=untrusted_app_30 type=app_data_file levelFrom=all
Jeff Vander Stoep1f7ae8e2020-01-20 10:14:48 +0100210user=_app minTargetSdkVersion=29 domain=untrusted_app_29 type=app_data_file levelFrom=all
Yabin Cui5dc2c8c2018-11-02 11:12:43 -0700211user=_app minTargetSdkVersion=28 domain=untrusted_app_27 type=app_data_file levelFrom=all
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800212user=_app minTargetSdkVersion=26 domain=untrusted_app_27 type=app_data_file levelFrom=user
Jeff Vander Stoepbacb6d72017-02-13 13:33:27 -0800213user=_app domain=untrusted_app_25 type=app_data_file levelFrom=user
Yabin Cui770a4f62019-01-07 16:37:24 -0800214user=_app minTargetSdkVersion=28 fromRunAs=true domain=runas_app levelFrom=all
215user=_app fromRunAs=true domain=runas_app levelFrom=user