Make sure that external callers cannot pass in the confirm bypass extra

Security fix for vulnerability where an app could launch into the screen lock
change dialog without first confirming the existing password/pattern.

Also, make sure that the fragments are launched with the correct corresponding
activity.

Bug: 9858403
Change-Id: I0f2c00a44abeb624c6fba0497bf6036a6f1a4564
This commit is contained in:
Amith Yamasani
2013-09-25 14:05:33 -07:00
parent 8243c9a722
commit 66026773bb
4 changed files with 20 additions and 4 deletions

View File

@@ -60,6 +60,9 @@ public class ChooseLockGeneric extends PreferenceActivity {
return false;
}
public static class InternalActivity extends ChooseLockGeneric {
}
public static class ChooseLockGenericFragment extends SettingsPreferenceFragment {
private static final int MIN_PASSWORD_LENGTH = 4;
private static final String KEY_UNLOCK_BACKUP_INFO = "unlock_backup_info";
@@ -97,7 +100,9 @@ public class ChooseLockGeneric extends PreferenceActivity {
// Defaults to needing to confirm credentials
final boolean confirmCredentials = getActivity().getIntent()
.getBooleanExtra(CONFIRM_CREDENTIALS, true);
mPasswordConfirmed = !confirmCredentials;
if (getActivity() instanceof ChooseLockGeneric.InternalActivity) {
mPasswordConfirmed = !confirmCredentials;
}
if (savedInstanceState != null) {
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
@@ -341,7 +346,8 @@ public class ChooseLockGeneric extends PreferenceActivity {
}
private Intent getBiometricSensorIntent() {
Intent fallBackIntent = new Intent().setClass(getActivity(), ChooseLockGeneric.class);
Intent fallBackIntent = new Intent().setClass(getActivity(),
ChooseLockGeneric.InternalActivity.class);
fallBackIntent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, true);
fallBackIntent.putExtra(CONFIRM_CREDENTIALS, false);
fallBackIntent.putExtra(EXTRA_SHOW_FRAGMENT_TITLE,