Skip to content

Conversation

@mtav
Copy link

@mtav mtav commented Sep 10, 2022

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 and others added 6 commits September 10, 2022 04:32
…= 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.
…or imported weak passwords that have previously been hashed.
-Import fails on invalid usernames.
-Import fails if user is valid, but already exists and still returns user_info.
-Otherwise import works.

Note: Password strength check not fixed yet.
"password" (cleartext or hash) gets decoded before any password checks and then re-encoded before being added to the database.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

import_from_firstuse not working: Previous users cannot log in or create an account.

2 participants