Merge "Add ComponentName explicitly to make sure arbitary intents aren't launched from Settings." into security-aosp-25Q2-staging
This commit is contained in:
committed by
Android (Google) Code Review
commit
a91dd2fb5b
@@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user