summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseem Kumar <aseemk@google.com>2025-04-16 11:22:07 -0700
committeraoleary <seanm187@gmail.com>2025-10-07 19:02:06 +0000
commit5b08a80dc58fc682baf167dea331c6efcd6a5443 (patch)
tree0a315097f730055240a5116b1b7c16a2200a684b
parent665ef2cb39d13b08672f35bc659822efa891b8ab (diff)
Add ComponentName explicitly to make sure arbitary intents aren't launched from Settings.
Bug: 378902342 Flag: EXEMPT security fix (cherry picked from commit 6a896b6b26d445800773e1b4649895bea17eac1f) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:947f4571bcd7aef74fd70d533fa26e06e088dab3) Merged-In: I0e67f1258cb427c5b998e40a8a0c104af3ead042 Change-Id: I0e67f1258cb427c5b998e40a8a0c104af3ead042
-rw-r--r--src/com/android/settings/accounts/AccountTypePreferenceLoader.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/settings/accounts/AccountTypePreferenceLoader.java b/src/com/android/settings/accounts/AccountTypePreferenceLoader.java
index 7cfeb1cc193..a90bea09747 100644
--- a/src/com/android/settings/accounts/AccountTypePreferenceLoader.java
+++ b/src/com/android/settings/accounts/AccountTypePreferenceLoader.java
@@ -264,7 +264,14 @@ public class AccountTypePreferenceLoader {
try {
// Allows to launch only authenticator owned activities.
ApplicationInfo authenticatorAppInf = pm.getApplicationInfo(authDesc.packageName, 0);
- return resolvedAppInfo.uid == authenticatorAppInf.uid;
+ if (resolvedAppInfo.uid == authenticatorAppInf.uid) {
+ // Explicitly set the component to be same as authenticator to
+ // prevent launching arbitrary activities.
+ intent.setComponent(resolvedActivityInfo.getComponentName());
+ return true;
+ } else {
+ return false;
+ }
} catch (NameNotFoundException e) {
Log.e(TAG,
"Intent considered unsafe due to exception.",