diff test/test_security.py @ 7165:970cd6d2b8ea

issue2551251 - migrate pbkdf2 passwords if more rounds configured migrate/re-encrypt PBKDF2 password if stored password used a smaller number of rounds than set in password_pbkdf2_default_rounds. Also increase fallback number of rounds (when not set in config) to 2,000,000.
author John Rouillard <rouilj@ieee.org>
date Thu, 23 Feb 2023 19:34:39 -0500
parents 0b52ee664580
children f6b24a8524cd
line wrap: on
line diff
--- a/test/test_security.py	Fri Feb 24 17:15:29 2023 -0500
+++ b/test/test_security.py	Thu Feb 23 19:34:39 2023 -0500
@@ -422,4 +422,14 @@
             roundup.password.test_missing_crypt()
         roundup.password.crypt = orig_crypt
 
+    def test_pbkdf2_migrate_rounds(self):
+        self.db.config.PASSWORD_PBKDF2_DEFAULT_ROUNDS = 10000
+
+        p = roundup.password.Password('sekrit', 'PBKDF2',
+                                      config=self.db.config)
+
+        self.db.config.PASSWORD_PBKDF2_DEFAULT_ROUNDS = 2000000
+
+        self.assertEqual(p.needs_migration(config=self.db.config), True)
+
 # vim: set filetype=python sts=4 sw=4 et si :

Roundup Issue Tracker: http://roundup-tracker.org/