mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Fix handling of small passphrase wordlists
* Fixes #11856 * Set the minimum recommended wordlist size to 1,296 - equal to the EFF Short List * Issue a clear warning when using a smaller wordlist but do not prevent generation of passphrases * Improve wording when removing custom wordlist
This commit is contained in:
@@ -1089,8 +1089,9 @@ void TestCli::testDiceware()
|
||||
}
|
||||
smallWordFile.close();
|
||||
|
||||
// Ensure a warning is shown if the wordlist is too short
|
||||
execCmd(dicewareCmd, {"diceware", "-W", "11", "-w", smallWordFile.fileName()});
|
||||
QCOMPARE(m_stderr->readLine(), QByteArray("Cannot generate valid passphrases because the wordlist is too short\n"));
|
||||
QVERIFY(m_stderr->readLine().length() > 0);
|
||||
}
|
||||
|
||||
void TestCli::testEdit()
|
||||
|
||||
@@ -34,7 +34,7 @@ void TestPassphraseGenerator::testWordCase()
|
||||
{
|
||||
PassphraseGenerator generator;
|
||||
generator.setWordSeparator(" ");
|
||||
QVERIFY(generator.isValid());
|
||||
QVERIFY(generator.isWordListValid());
|
||||
|
||||
QString passphrase;
|
||||
passphrase = generator.generatePassphrase();
|
||||
@@ -57,14 +57,14 @@ void TestPassphraseGenerator::testWordCase()
|
||||
void TestPassphraseGenerator::testUniqueEntriesInWordlist()
|
||||
{
|
||||
PassphraseGenerator generator;
|
||||
// set the limit down, so we don;t have to do a very large file
|
||||
generator.m_minimum_wordlist_length = 4;
|
||||
// set the limit down, so we don't have to do a very large file
|
||||
generator.m_minWordListSize = 4;
|
||||
|
||||
// link to bad wordlist
|
||||
QString path = QString(KEEPASSX_TEST_DATA_DIR).append("/wordlists/bad_wordlist_with_duplicate_entries.wordlist");
|
||||
|
||||
// setting will work, it creates the warning however, and isValid will fail
|
||||
// setting will work, it creates the warning however, and isWordListValid will fail
|
||||
generator.setWordList(path);
|
||||
// so this fails
|
||||
QVERIFY(!generator.isValid());
|
||||
QVERIFY(!generator.isWordListValid());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user