Skip to content

Commit d44c51e

Browse files
author
Mugdha Lakhani
committed
Add canary restrictions for sdk_sandbox
Add sdk_sandbox_next and apply it if a new input selector, isSdkSandboxNext, is applied. This is set to true by libselinux if a flag is set in the seInfo passed to it. This enables some testers to test out the set of restrictions we're planning for the next SDK version. sdk_sandbox_next is not the final set of restrictions of the next SDK version. Bug: b/270148964 Test: atest PackageManagerLocalTest SdkSandboxDataIsolationHostTest SdkSandboxRestrictionsTest Change-Id: Ie8bad9c1b8f8eb032d13e1822689c78ad3d2c68a Merged-In: Ie8bad9c1b8f8eb032d13e1822689c78ad3d2c68a
1 parent 62037d3 commit d44c51e

File tree

5 files changed

+187
-0
lines changed

5 files changed

+187
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
###
2+
### SDK Sandbox process.
3+
###
4+
### This file defines the security policy for the sdk sandbox processes
5+
### for targetSdkVersion=34.
6+
type sdk_sandbox_next, domain, coredomain, sdk_sandbox_all;
7+
8+
net_domain(sdk_sandbox_next)
9+
app_domain(sdk_sandbox_next)
10+
11+
# Allow finding services. This is different from ephemeral_app policy.
12+
# Adding services manually to the allowlist is preferred hence app_api_service is not used.
13+
allow sdk_sandbox_next {
14+
activity_service
15+
activity_task_service
16+
appops_service
17+
audio_service
18+
audioserver_service
19+
batteryproperties_service
20+
batterystats_service
21+
connectivity_service
22+
connmetrics_service
23+
deviceidle_service
24+
display_service
25+
dropbox_service
26+
font_service
27+
game_service
28+
gpu_service
29+
graphicsstats_service
30+
hardware_properties_service
31+
hint_service
32+
imms_service
33+
input_method_service
34+
input_service
35+
IProxyService_service
36+
ipsec_service
37+
launcherapps_service
38+
legacy_permission_service
39+
light_service
40+
locale_service
41+
media_communication_service
42+
mediaextractor_service
43+
mediametrics_service
44+
media_projection_service
45+
media_router_service
46+
mediaserver_service
47+
media_session_service
48+
memtrackproxy_service
49+
midi_service
50+
netpolicy_service
51+
netstats_service
52+
network_management_service
53+
notification_service
54+
package_service
55+
permission_checker_service
56+
permission_service
57+
permissionmgr_service
58+
platform_compat_service
59+
power_service
60+
procstats_service
61+
registry_service
62+
restrictions_service
63+
rttmanager_service
64+
search_service
65+
selection_toolbar_service
66+
sensor_privacy_service
67+
sensorservice_service
68+
servicediscovery_service
69+
settings_service
70+
speech_recognition_service
71+
statusbar_service
72+
storagestats_service
73+
surfaceflinger_service
74+
telecom_service
75+
tethering_service
76+
textclassification_service
77+
textservices_service
78+
texttospeech_service
79+
thermal_service
80+
translation_service
81+
tv_iapp_service
82+
tv_input_service
83+
uimode_service
84+
vcn_management_service
85+
webviewupdate_service
86+
}:service_manager find;
87+

prebuilts/api/34.0/private/seapp_contexts

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# minTargetSdkVersion (unsigned integer)
1313
# fromRunAs (boolean)
1414
# isIsolatedComputeApp (boolean)
15+
# isSdkSandboxNext (boolean)
1516
#
1617
# All specified input selectors in an entry must match (i.e. logical AND).
1718
# An unspecified string or boolean selector with no default will match any
@@ -47,6 +48,9 @@
4748
# with user=_isolated. This selector should not be used unless it is intended
4849
# to provide isolated processes with relaxed security restrictions.
4950
#
51+
# isSdkSandboxNext=true means sdk sandbox processes will get
52+
# sdk_sandbox_next sepolicy applied to them.
53+
#
5054
# Precedence: entries are compared using the following rules, in the order shown
5155
# (see external/selinux/libselinux/src/android/android_platform.c,
5256
# seapp_context_cmp()).
@@ -64,6 +68,7 @@
6468
# defaults to 0 if unspecified.
6569
# (8) fromRunAs=true before fromRunAs=false.
6670
# (9) isIsolatedComputeApp=true before isIsolatedComputeApp=false
71+
# (10) isSdkSandboxNext=true before isSdkSandboxNext=false
6772
# (A fixed selector is more specific than a prefix, i.e. ending in *, and a
6873
# longer prefix is more specific than a shorter prefix.)
6974
# Apps are checked against entries in precedence order until the first match,
@@ -165,6 +170,7 @@ user=webview_zygote seinfo=webview_zygote domain=webview_zygote
165170
user=_isolated domain=isolated_app levelFrom=user
166171
user=_isolated isIsolatedComputeApp=true domain=isolated_compute_app levelFrom=user
167172
user=_sdksandbox domain=sdk_sandbox_34 type=sdk_sandbox_data_file levelFrom=all
173+
user=_sdksandbox isSdkSandboxNext=true domain=sdk_sandbox_next type=sdk_sandbox_data_file levelFrom=all
168174
user=_app seinfo=app_zygote domain=app_zygote levelFrom=user
169175
user=_app seinfo=media domain=mediaprovider type=app_data_file levelFrom=user
170176
user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user

private/sdk_sandbox_next.te

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
###
2+
### SDK Sandbox process.
3+
###
4+
### This file defines the security policy for the sdk sandbox processes
5+
### for targetSdkVersion=34.
6+
type sdk_sandbox_next, domain, coredomain, sdk_sandbox_all;
7+
8+
net_domain(sdk_sandbox_next)
9+
app_domain(sdk_sandbox_next)
10+
11+
# Allow finding services. This is different from ephemeral_app policy.
12+
# Adding services manually to the allowlist is preferred hence app_api_service is not used.
13+
allow sdk_sandbox_next {
14+
activity_service
15+
activity_task_service
16+
appops_service
17+
audio_service
18+
audioserver_service
19+
batteryproperties_service
20+
batterystats_service
21+
connectivity_service
22+
connmetrics_service
23+
deviceidle_service
24+
display_service
25+
dropbox_service
26+
font_service
27+
game_service
28+
gpu_service
29+
graphicsstats_service
30+
hardware_properties_service
31+
hint_service
32+
imms_service
33+
input_method_service
34+
input_service
35+
IProxyService_service
36+
ipsec_service
37+
launcherapps_service
38+
legacy_permission_service
39+
light_service
40+
locale_service
41+
media_communication_service
42+
mediaextractor_service
43+
mediametrics_service
44+
media_projection_service
45+
media_router_service
46+
mediaserver_service
47+
media_session_service
48+
memtrackproxy_service
49+
midi_service
50+
netpolicy_service
51+
netstats_service
52+
network_management_service
53+
notification_service
54+
package_service
55+
permission_checker_service
56+
permission_service
57+
permissionmgr_service
58+
platform_compat_service
59+
power_service
60+
procstats_service
61+
registry_service
62+
restrictions_service
63+
rttmanager_service
64+
search_service
65+
selection_toolbar_service
66+
sensor_privacy_service
67+
sensorservice_service
68+
servicediscovery_service
69+
settings_service
70+
speech_recognition_service
71+
statusbar_service
72+
storagestats_service
73+
surfaceflinger_service
74+
telecom_service
75+
tethering_service
76+
textclassification_service
77+
textservices_service
78+
texttospeech_service
79+
thermal_service
80+
translation_service
81+
tv_iapp_service
82+
tv_input_service
83+
uimode_service
84+
vcn_management_service
85+
webviewupdate_service
86+
}:service_manager find;
87+

private/seapp_contexts

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# minTargetSdkVersion (unsigned integer)
1313
# fromRunAs (boolean)
1414
# isIsolatedComputeApp (boolean)
15+
# isSdkSandboxNext (boolean)
1516
#
1617
# All specified input selectors in an entry must match (i.e. logical AND).
1718
# An unspecified string or boolean selector with no default will match any
@@ -47,6 +48,9 @@
4748
# with user=_isolated. This selector should not be used unless it is intended
4849
# to provide isolated processes with relaxed security restrictions.
4950
#
51+
# isSdkSandboxNext=true means sdk sandbox processes will get
52+
# sdk_sandbox_next sepolicy applied to them.
53+
#
5054
# Precedence: entries are compared using the following rules, in the order shown
5155
# (see external/selinux/libselinux/src/android/android_platform.c,
5256
# seapp_context_cmp()).
@@ -64,6 +68,7 @@
6468
# defaults to 0 if unspecified.
6569
# (8) fromRunAs=true before fromRunAs=false.
6670
# (9) isIsolatedComputeApp=true before isIsolatedComputeApp=false
71+
# (10) isSdkSandboxNext=true before isSdkSandboxNext=false
6772
# (A fixed selector is more specific than a prefix, i.e. ending in *, and a
6873
# longer prefix is more specific than a shorter prefix.)
6974
# Apps are checked against entries in precedence order until the first match,
@@ -165,6 +170,7 @@ user=webview_zygote seinfo=webview_zygote domain=webview_zygote
165170
user=_isolated domain=isolated_app levelFrom=user
166171
user=_isolated isIsolatedComputeApp=true domain=isolated_compute_app levelFrom=user
167172
user=_sdksandbox domain=sdk_sandbox_34 type=sdk_sandbox_data_file levelFrom=all
173+
user=_sdksandbox isSdkSandboxNext=true domain=sdk_sandbox_next type=sdk_sandbox_data_file levelFrom=all
168174
user=_app seinfo=app_zygote domain=app_zygote levelFrom=user
169175
user=_app seinfo=media domain=mediaprovider type=app_data_file levelFrom=user
170176
user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user

tools/check_seapp.c

+1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ key_map rules[] = {
214214
{ .name = "minTargetSdkVersion", .dir = dir_in, .fn_validate = validate_uint },
215215
{ .name = "fromRunAs", .dir = dir_in, .fn_validate = validate_bool },
216216
{ .name = "isIsolatedComputeApp", .dir = dir_in, .fn_validate = validate_bool },
217+
{ .name = "isSdkSandboxNext", .dir = dir_in, .fn_validate = validate_bool },
217218
/*Outputs*/
218219
{ .name = "domain", .dir = dir_out, .fn_validate = validate_domain },
219220
{ .name = "type", .dir = dir_out, .fn_validate = validate_type },

0 commit comments

Comments
 (0)