Block the content scheme intent in AccountTypePreferenceLoader
Also prevent intent defined in AccountPreference from leaking access
Bug: 366401629
Flag: EXEMPT security fix
Test: atest AccountTypePreferenceLoaderTest, manual
Change-Id: Ica87087341cc983df04190919e33dc369fa18619
Merged-In: Ica87087341cc983df04190919e33dc369fa18619
(cherry picked from commit 841fb3846b
)
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.accounts;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -26,8 +28,11 @@ import static org.mockito.Mockito.when;
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.accounts.AuthenticatorDescription;
|
||||
import android.content.ClipData;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.UserHandle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
@@ -129,4 +134,13 @@ public class AccountTypePreferenceLoaderTest {
|
||||
verify(mPrefLoader).updatePreferenceIntents(prefGroup4, acctType, mAccount);
|
||||
verify(mPrefLoader).updatePreferenceIntents(prefGroup41, acctType, mAccount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSafeIntent_hasContextScheme_returnFalse() {
|
||||
Intent intent = new Intent();
|
||||
intent.setClipData(ClipData.newRawUri(null,
|
||||
Uri.parse("content://com.android.settings.files/my_cache/NOTICE.html")));
|
||||
|
||||
assertThat(mPrefLoader.isSafeIntent(mPackageManager, intent, mAccount.type)).isFalse();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user