1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-22 19:23:24 +00:00

Increase error checking on imported Login items

This commit is contained in:
Thomas Rittson
2021-05-05 11:57:56 +10:00
parent a72c8a60c1
commit 1729452786

View File

@@ -155,13 +155,14 @@ export class ImportService implements ImportServiceAbstraction {
if (importResult.folders.length === 0 && importResult.ciphers.length === 0) {
return new Error(this.i18nService.t('importNothingError'));
} else if (importResult.ciphers.length > 0) {
const halfway = Math.floor(importResult.ciphers.length / 2);
const last = importResult.ciphers.length - 1;
if (this.badData(importResult.ciphers[0]) &&
this.badData(importResult.ciphers[halfway]) &&
this.badData(importResult.ciphers[last])) {
return new Error(this.i18nService.t('importFormatError'));
let badDataThreshold = 10;
for (const cipher of importResult.ciphers) {
if (this.badData(cipher)) {
badDataThreshold--;
if (badDataThreshold === 0) {
return new Error(this.i18nService.t('importFormatError'));
}
}
}
}
try {