blob: 2219631958e04bea08b04e7f22223d097868c310 [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#
Sandro Montanari1e9eb362023-11-17 09:54:33 +000059# The sdk_sandbox_next and sdk_sandbox_audit domains are special domains for the
60# SDK sandbox process. sdk_sandbox_next defines the set of restrictions proposed
61# for the upcoming dessert release. sdk_sandbox_audit uses the same restrictions
62# as the current dessert release, with additional auditing rules for the accesses
63# we are considering forbidding in the upcoming release.
64#
Mugdha Lakhani49075f92023-05-07 17:41:57 +000065# isSdkSandboxNext=true means sdk sandbox processes will get
66# sdk_sandbox_next sepolicy applied to them.
Inseob Kim9d6ce192023-07-17 19:53:25 +090067# An unspecified isSdkSandboxNext defaults to false.
Mugdha Lakhani49075f92023-05-07 17:41:57 +000068#
Sandro Montanari4db0e272023-10-19 15:00:55 +000069# isSdkSandboxAudit=true means sdk sandbox processes will get
70# sdk_sandbox_audit sepolicy applied to them.
71# An unspecified isSdkSandboxAudit defaults to false.
72#
Sandro Montanari1e9eb362023-11-17 09:54:33 +000073# isSdkSandboxAudit=true means sdk sandbox processes will get
74# sdk_sandbox_audit sepolicy applied to them.
75# An unspecified isSdkSandboxAudit defaults to false.
76#
Alan Stokes6b576bd2019-01-31 15:16:01 +000077# Precedence: entries are compared using the following rules, in the order shown
78# (see external/selinux/libselinux/src/android/android_platform.c,
79# seapp_context_cmp()).
Michael Peckf54b3622017-02-14 09:48:57 -080080# (1) isSystemServer=true before isSystemServer=false.
Alan Stokes6b576bd2019-01-31 15:16:01 +000081# (2) Specified isEphemeralApp= before unspecified isEphemeralApp=
82# boolean.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020083# (3) Specified user= string before unspecified user= string;
Alan Stokes6b576bd2019-01-31 15:16:01 +000084# more specific user= string before less specific user= string.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020085# (4) Specified seinfo= string before unspecified seinfo= string.
86# (5) Specified name= string before unspecified name= string;
Alan Stokes6b576bd2019-01-31 15:16:01 +000087# more specific name= string before less specific name= string.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020088# (6) Specified isPrivApp= before unspecified isPrivApp= boolean.
89# (7) Higher value of minTargetSdkVersion= before lower value of
Alan Stokes6b576bd2019-01-31 15:16:01 +000090# minTargetSdkVersion= integer. Note that minTargetSdkVersion=
91# defaults to 0 if unspecified.
Jeff Vander Stoep35779f02021-07-01 10:28:37 +020092# (8) fromRunAs=true before fromRunAs=false.
Inseob Kim7bb1b5d2023-07-21 18:20:10 +090093# (9) Platform seapp_contexts files (system, system_ext, product) before
94# vendor seapp_contexts files (vendor, odm).
Alan Stokes6b576bd2019-01-31 15:16:01 +000095# (A fixed selector is more specific than a prefix, i.e. ending in *, and a
96# longer prefix is more specific than a shorter prefix.)
97# Apps are checked against entries in precedence order until the first match,
98# regardless of their order in this file.
99#
100# Duplicate entries, i.e. with identical input selectors, are not allowed.
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500101#
102# Outputs:
Michael Peckf54b3622017-02-14 09:48:57 -0800103# domain (string)
104# type (string)
105# levelFrom (string; one of none, all, app, or user)
106# level (string)
Alan Stokes6b576bd2019-01-31 15:16:01 +0000107#
108# domain= determines the label to be used for the app process; entries
109# without domain= are ignored for this purpose.
110# type= specifies the label to be used for the app data directory; entries
Alan Stokesf8ad3392020-10-27 17:35:33 +0000111# without type= are ignored for this purpose. The label specified must
112# have the app_data_file_type attribute.
Alan Stokes6b576bd2019-01-31 15:16:01 +0000113# levelFrom and level are used to determine the level (sensitivity + categories)
114# for MLS/MCS.
115# levelFrom=none omits the level.
116# levelFrom=app determines the level from the process UID.
117# levelFrom=user determines the level from the user ID.
118# levelFrom=all determines the level from both UID and user ID.
Nick Kralevich795add52019-04-16 15:56:33 -0700119#
Stephen Smalley38084142012-11-28 10:46:18 -0500120# levelFrom=user is only supported for _app or _isolated UIDs.
121# levelFrom=app or levelFrom=all is only supported for _app UIDs.
Nick Kralevich4be31902014-07-01 13:59:50 -0700122# level may be used to specify a fixed level for any UID.
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500123#
Alan Stokes6b576bd2019-01-31 15:16:01 +0000124# For backwards compatibility levelFromUid=true is equivalent to levelFrom=app
125# and levelFromUid=false is equivalent to levelFrom=none.
126#
William Roberts81e1f902015-06-03 21:57:47 -0700127#
128# Neverallow Assertions
Alan Stokes6b576bd2019-01-31 15:16:01 +0000129# Additional compile time assertion checks for the rules in this file can be
130# added as well. The assertion
William Roberts81e1f902015-06-03 21:57:47 -0700131# rules are lines beginning with the keyword neverallow. Full support for PCRE
132# regular expressions exists on all input and output selectors. Neverallow
133# rules are never output to the built seapp_contexts file. Like all keywords,
134# neverallows are case-insensitive. A neverallow is asserted when all key value
135# inputs are matched on a key value rule line.
136#
137
Alan Stokes665c2952021-11-26 11:39:02 +0000138# only the system server can be assigned the system_server domains
William Roberts81e1f902015-06-03 21:57:47 -0700139neverallow isSystemServer=false domain=system_server
Alan Stokes665c2952021-11-26 11:39:02 +0000140neverallow isSystemServer=false domain=system_server_startup
William Roberts81e1f902015-06-03 21:57:47 -0700141neverallow isSystemServer="" domain=system_server
Alan Stokes665c2952021-11-26 11:39:02 +0000142neverallow isSystemServer="" domain=system_server_startup
William Roberts81e1f902015-06-03 21:57:47 -0700143
144# system domains should never be assigned outside of system uid
145neverallow user=((?!system).)* domain=system_app
146neverallow user=((?!system).)* type=system_app_data_file
147
Ashwini Oruganti04f771d2019-10-31 15:45:00 -0700148# any non priv-app with a non-known uid with a specified name should have a specified
149# seinfo
150neverallow user=_app isPrivApp=false name=.* seinfo=""
151neverallow user=_app isPrivApp=false name=.* seinfo=default
William Roberts81e1f902015-06-03 21:57:47 -0700152
153# neverallow shared relro to any other domain
154# and neverallow any other uid into shared_relro
155neverallow user=shared_relro domain=((?!shared_relro).)*
156neverallow user=((?!shared_relro).)* domain=shared_relro
157
158# neverallow non-isolated uids into isolated_app domain
159# and vice versa
Charles Chen30704922023-01-15 05:41:42 +0000160neverallow user=_isolated isIsolatedComputeApp=false domain=((?!isolated_app).)*
William Roberts81e1f902015-06-03 21:57:47 -0700161neverallow user=((?!_isolated).)* domain=isolated_app
162
Charles Chen30704922023-01-15 05:41:42 +0000163# neverallow isolatedComputeApp into domains other than isolated_compute_app
164neverallow user=_isolated isIsolatedComputeApp=true domain=((?!isolated_compute_app).)*
165
William Roberts81e1f902015-06-03 21:57:47 -0700166# uid shell should always be in shell domain, however non-shell
167# uid's can be in shell domain
168neverallow user=shell domain=((?!shell).)*
169
Max Bires77d41f72018-01-24 21:17:18 +0000170# only the package named com.android.shell can run in the shell domain
171neverallow domain=shell name=((?!com\.android\.shell).)*
172neverallow user=shell name=((?!com\.android\.shell).)*
173
Chad Brubaker06cf31e2016-10-06 13:15:44 -0700174# Ephemeral Apps must run in the ephemeral_app domain
175neverallow isEphemeralApp=true domain=((?!ephemeral_app).)*
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -0700176
Nick Kralevichcaf42d62018-10-04 10:57:29 -0700177isSystemServer=true domain=system_server_startup
178
Mugdha Lakhani2ae45c52023-04-28 09:22:15 +0000179# sdksandbox must run in an sdksandbox domain
180neverallow user=_sdksandbox domain=((?!sdk_sandbox).)*
RafayKamranf3bdc0b2021-11-03 16:08:04 +0000181
Kevin Jeon4241e002022-01-26 22:32:40 +0000182user=_app seinfo=platform name=com.android.traceur domain=traceur_app type=app_data_file levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700183user=system seinfo=platform domain=system_app type=system_app_data_file
Avichal Rakeshe0929242023-01-23 23:49:50 -0800184user=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 -0700185user=bluetooth seinfo=bluetooth domain=bluetooth type=bluetooth_data_file
markchien48c600f2020-11-26 09:55:56 +0800186user=network_stack seinfo=network_stack domain=network_stack type=radio_data_file
Roshan Pius23a929d2023-11-03 17:39:43 -0700187# NFC stack signed with platform cert needed for maintaining backwards comptibility for -next release config.
William Roberts92dfa312014-09-29 10:29:48 -0700188user=nfc seinfo=platform domain=nfc type=nfc_data_file
Roshan Pius23a929d2023-11-03 17:39:43 -0700189user=nfc seinfo=nfc domain=nfc type=nfc_data_file
Ruchi Kandoi8a2b4a72018-01-04 10:33:20 -0800190user=secure_element seinfo=platform domain=secure_element levelFrom=all
William Roberts92dfa312014-09-29 10:29:48 -0700191user=radio seinfo=platform domain=radio type=radio_data_file
Alan Stokesc7229c72020-09-24 13:46:46 +0100192user=shared_relro domain=shared_relro levelFrom=all
Max Bires77d41f72018-01-24 21:17:18 +0000193user=shell seinfo=platform domain=shell name=com.android.shell type=shell_data_file
Robert Sesekbacb19b2018-01-30 10:54:33 -0500194user=webview_zygote seinfo=webview_zygote domain=webview_zygote
Martijn Coenend40dfdc2020-06-08 20:31:33 +0200195user=_isolated domain=isolated_app levelFrom=user
Charles Chenbc965c92023-01-29 12:04:20 +0000196user=_isolated isIsolatedComputeApp=true domain=isolated_compute_app levelFrom=user
Mugdha Lakhani2ae45c52023-04-28 09:22:15 +0000197user=_sdksandbox domain=sdk_sandbox_34 type=sdk_sandbox_data_file levelFrom=all
Mugdha Lakhani49075f92023-05-07 17:41:57 +0000198user=_sdksandbox isSdkSandboxNext=true domain=sdk_sandbox_next type=sdk_sandbox_data_file levelFrom=all
Sandro Montanari4db0e272023-10-19 15:00:55 +0000199user=_sdksandbox isSdkSandboxAudit=true domain=sdk_sandbox_audit type=sdk_sandbox_data_file levelFrom=all
Martijn Coenend40dfdc2020-06-08 20:31:33 +0200200user=_app seinfo=app_zygote domain=app_zygote levelFrom=user
Jeff Vander Stoepfcf12fd2020-04-22 15:26:02 +0200201user=_app seinfo=media domain=mediaprovider type=app_data_file levelFrom=user
Stephen Smalleya8337632014-09-11 14:07:28 -0400202user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user
Nick Kralevich795add52019-04-16 15:56:33 -0700203user=_app isEphemeralApp=true domain=ephemeral_app type=app_data_file levelFrom=all
Nick Kralevich5d175512018-09-12 12:30:32 -0700204user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user
Ashwini Oruganti04f771d2019-10-31 15:45:00 -0700205user=_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 +0200206user=_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 +0000207user=_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 +0100208user=_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 +0000209user=_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 -0700210user=_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 -0800211user=_app isPrivApp=true name=com.android.vzwomatrigger domain=vzwomatrigger_app type=privapp_data_file levelFrom=all
Alan Stokes12de1842023-06-08 11:24:56 +0100212user=_app isPrivApp=true name=com.android.rkpdapp domain=rkpdapp type=privapp_data_file levelFrom=all
213user=_app isPrivApp=true name=com.google.android.rkpdapp domain=rkpdapp type=privapp_data_file levelFrom=all
Ashwini Orugantic46a7bc2019-10-29 14:13:20 -0700214user=_app isPrivApp=true name=com.google.android.gms domain=gmscore_app type=privapp_data_file levelFrom=user
215user=_app isPrivApp=true name=com.google.android.gms.* domain=gmscore_app type=privapp_data_file levelFrom=user
216user=_app isPrivApp=true name=com.google.android.gms:* domain=gmscore_app type=privapp_data_file levelFrom=user
Ashwini Orugantiefc3bdb2020-04-22 10:22:45 -0700217user=_app isPrivApp=true name=com.google.android.gsf domain=gmscore_app type=privapp_data_file levelFrom=user
Yuyang Huangcfdea5f2023-01-18 16:52:43 +0900218user=_app minTargetSdkVersion=34 domain=untrusted_app type=app_data_file levelFrom=all
219user=_app minTargetSdkVersion=32 domain=untrusted_app_32 type=app_data_file levelFrom=all
Bram Bonnéea5460a2021-05-12 14:19:24 +0200220user=_app minTargetSdkVersion=30 domain=untrusted_app_30 type=app_data_file levelFrom=all
Jeff Vander Stoep1f7ae8e2020-01-20 10:14:48 +0100221user=_app minTargetSdkVersion=29 domain=untrusted_app_29 type=app_data_file levelFrom=all
Yabin Cui5dc2c8c2018-11-02 11:12:43 -0700222user=_app minTargetSdkVersion=28 domain=untrusted_app_27 type=app_data_file levelFrom=all
Jeff Vander Stoep6231b4d2017-12-17 20:55:12 -0800223user=_app minTargetSdkVersion=26 domain=untrusted_app_27 type=app_data_file levelFrom=user
Jeff Vander Stoepbacb6d72017-02-13 13:33:27 -0800224user=_app domain=untrusted_app_25 type=app_data_file levelFrom=user
Yabin Cui770a4f62019-01-07 16:37:24 -0800225user=_app minTargetSdkVersion=28 fromRunAs=true domain=runas_app levelFrom=all
226user=_app fromRunAs=true domain=runas_app levelFrom=user