nativeauthenticator icon indicating copy to clipboard operation
nativeauthenticator copied to clipboard

Fix broken implementation of `import_from_firstuse`

Open mtav opened this issue 2 years ago • 0 comments

This would fix #219 when using c.NativeAuthenticator.import_from_firstuse = True:

When importing users from passwords.dbm, the hashed password was processed as if it was a cleartext password, leading the original password to fail and preventing imported users from logging in.

An extra keyword option "from_firstuse" was added to create_user() to handle this special case.

The code also silently skips existing users on import to avoid overwriting their password. This is to handle the case when users do not wish to delete their FirstUseAuthenticator database after the first import, in which case the re-import at each hub reload could cause any password changes done after to be overwritten, or constant reload failures.

Note about password checks on import: The FirstUse Authenticator stores hashed passwords, so checking if they are based on common passwords would be quite time consuming. So the import only checks for valid usernames, not if the passwords are long enough or common.

mtav avatar Sep 10 '22 04:09 mtav