Merge "Add ComponentName explicitly to make sure arbitary intents aren't launched from Settings." into security-aosp-25Q2-staging

This commit is contained in:
Justin Dunlap
2025-05-20 07:55:24 -07:00
committed by Android (Google) Code Review

View File

@@ -265,7 +265,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.",