1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-05 09:01:11 +01:00

PM-1076 added warning on unlocking iOS extensions when the kdf type is argon2id and the memory is higher than 48MB, to let the user know that unlocking might crash the extension (#2560)

This commit is contained in:
Federico Maccaroni 2023-06-07 16:21:51 +02:00 committed by GitHub
parent 1c13ed9895
commit 3b087c50ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 0 deletions

View File

@ -6434,6 +6434,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Unlocking may fail due to insufficient memory. Decrease your KDF memory settings to resolve.
/// </summary>
public static string UnlockingMayFailDueToInsufficientMemoryDecreaseYourKDFMemorySettingsToResolve {
get {
return ResourceManager.GetString("UnlockingMayFailDueToInsufficientMemoryDecreaseYourKDFMemorySettingsToResolve", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Unlock vault. /// Looks up a localized string similar to Unlock vault.
/// </summary> /// </summary>

View File

@ -2634,4 +2634,7 @@ Do you want to switch to this account?</value>
<data name="MasterPasswordRePromptHelp" xml:space="preserve"> <data name="MasterPasswordRePromptHelp" xml:space="preserve">
<value>Master password re-prompt help</value> <value>Master password re-prompt help</value>
</data> </data>
<data name="UnlockingMayFailDueToInsufficientMemoryDecreaseYourKDFMemorySettingsToResolve" xml:space="preserve">
<value>Unlocking may fail due to insufficient memory. Decrease your KDF memory settings to resolve</value>
</data>
</root> </root>

View File

@ -32,5 +32,6 @@
public const string UTTypeAppExtensionImage = "public.image"; public const string UTTypeAppExtensionImage = "public.image";
public const string AutofillNeedsIdentityReplacementKey = "autofillNeedsIdentityReplacement"; public const string AutofillNeedsIdentityReplacementKey = "autofillNeedsIdentityReplacement";
public const int MaximumArgon2IdMemoryBeforeExtensionCrashing = 48;
} }
} }

View File

@ -225,6 +225,18 @@ namespace Bit.iOS.Core.Controllers
var kdfConfig = await _stateService.GetActiveUserCustomDataAsync(a => new KdfConfig(a?.Profile)); var kdfConfig = await _stateService.GetActiveUserCustomDataAsync(a => new KdfConfig(a?.Profile));
var inputtedValue = MasterPasswordCell.TextField.Text; var inputtedValue = MasterPasswordCell.TextField.Text;
// HACK: iOS extensions have constrained memory, given how it works Argon2Id, it's likely to crash
// the extension depending on the argon2id memory configured.
// So, we warn the user and advise to decrease the configured memory letting them the option to continue, if wanted.
if (kdfConfig.Type == KdfType.Argon2id
&&
kdfConfig.Memory > Constants.MaximumArgon2IdMemoryBeforeExtensionCrashing
&&
!await _platformUtilsService.ShowDialogAsync(AppResources.UnlockingMayFailDueToInsufficientMemoryDecreaseYourKDFMemorySettingsToResolve, AppResources.Warning, AppResources.Continue, AppResources.Cancel))
{
return;
}
if (_pinLock) if (_pinLock)
{ {
var failed = true; var failed = true;