Fix pendingIntent in SettingsSliceProvider could be Hijacked
A malicious app is able to obtain this pending intent.
It can then mutate all fields except for the action and
launch the intent. This can be used to launch any activity
with the ACTION_SETTINGS action.
So, we enfore assign the package name for this intent,
it only can launch the settings app.
Fix: 147355897
Test: a) Install the new settings apk, and it won't launch other screen.
(See details in bug)
b) Start the settings search, slice search results work as normal.
Change-Id: Ie954d8a4b7153d6a4cac40621f363b45185990f2
(cherry picked from commit b3c0a2a6c1
)
Merged-In: Ie954d8a4b7153d6a4cac40621f363b45185990f2
This commit is contained in:
@@ -44,6 +44,7 @@ import androidx.slice.Slice;
|
||||
import androidx.slice.SliceProvider;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.bluetooth.BluetoothSliceBuilder;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.notification.zen.ZenModeSliceBuilder;
|
||||
@@ -322,7 +323,8 @@ public class SettingsSliceProvider extends SliceProvider {
|
||||
@Override
|
||||
public PendingIntent onCreatePermissionRequest(@NonNull Uri sliceUri,
|
||||
@NonNull String callingPackage) {
|
||||
final Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS);
|
||||
final Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS)
|
||||
.setPackage(Utils.SETTINGS_PACKAGE_NAME);
|
||||
final PendingIntent noOpIntent = PendingIntent.getActivity(getContext(),
|
||||
0 /* requestCode */, settingsIntent, 0 /* flags */);
|
||||
return noOpIntent;
|
||||
|
Reference in New Issue
Block a user