Add a no-op flag to mutable implicit PendingIntents

Starting from target SDK U, we will block creation of mutable
PendingIntents with implicit Intents because attackers can mutate the
Intent object within and launch altered behavior on behalf of victim
apps. For more details on the vulnerability, see go/pendingintent-rca.

From a quick analysis, we concluded that the intents passed into
getPendingIntent() can be both explicit and implicit, so we added
a no-op FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT to bypass the above block of
mutable implicit PendingIntents.

The flag is introduced in ag/21018466.

Bug: 236704164
Bug: 229362273
Test: TH passes
Change-Id: Ia26c8f92d1b4b50e04bc6b487619f54efc7d5a1d
This commit is contained in:
Azhara Assanova
2023-01-17 19:37:39 +00:00
parent 49fcae002c
commit bf0e65a6e9

View File

@@ -17,6 +17,7 @@
package com.android.quickstep.util;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT;
import static android.app.PendingIntent.FLAG_MUTABLE;
import static com.android.launcher3.Utilities.postAsyncCallback;
@@ -310,8 +311,9 @@ public class SplitSelectStateController {
private PendingIntent getPendingIntent(Intent intent) {
return intent == null ? null : (mUser != null
? PendingIntent.getActivityAsUser(mContext, 0, intent,
FLAG_MUTABLE, null /* options */, mUser)
: PendingIntent.getActivity(mContext, 0, intent, FLAG_MUTABLE));
FLAG_MUTABLE | FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT, null /* options */, mUser)
: PendingIntent.getActivity(mContext, 0, intent,
FLAG_MUTABLE | FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT));
}
public @StagePosition int getActiveSplitStagePosition() {