diff options
| author | 2022-12-29 15:18:07 +0000 | |
|---|---|---|
| committer | 2023-01-10 11:36:07 +0000 | |
| commit | 43b8a91b0584dd1c6a136702e68e1f0cd519cb51 (patch) | |
| tree | 5067e4c1c8ce60dc25acb6911755d743a25e85cc | |
| parent | e190822d5fac6ff3d53bef60f888a3c303762c1d (diff) | |
Isolated processes must fail registering BRs.
Broadcast Receivers should not be allowed to be registered by
isolated processes.
Bug: b/263358101
Test: atest SdkSandboxRestrictionsHostTest
Change-Id: I5bb2ee3ce8a447105a18851fdffa5a769cc3fe49
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 191460c385ad..3e7e7aa1cfcd 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -13500,12 +13500,17 @@ public class ActivityManagerService extends IActivityManager.Stub public Intent registerReceiverWithFeature(IApplicationThread caller, String callerPackage, String callerFeatureId, String receiverId, IIntentReceiver receiver, IntentFilter filter, String permission, int userId, int flags) { + enforceNotIsolatedCaller("registerReceiver"); + // Allow Sandbox process to register only unexported receivers. - if ((flags & Context.RECEIVER_NOT_EXPORTED) != 0) { - enforceNotIsolatedCaller("registerReceiver"); - } else if (mSdkSandboxSettings.isBroadcastReceiverRestrictionsEnforced()) { - enforceNotIsolatedOrSdkSandboxCaller("registerReceiver"); + boolean unexported = (flags & Context.RECEIVER_NOT_EXPORTED) != 0; + if (mSdkSandboxSettings.isBroadcastReceiverRestrictionsEnforced() + && Process.isSdkSandboxUid(Binder.getCallingUid()) + && !unexported) { + throw new SecurityException("SDK sandbox process not allowed to call " + + "registerReceiver"); } + ArrayList<Intent> stickyIntents = null; ProcessRecord callerApp = null; final boolean visibleToInstantApps |