Fix broken implementation of import_from_firstuse#221
Open
mtav wants to merge 6 commits into
Open
Conversation
…= 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.
for more information, see https://pre-commit.ci
…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.
import_from_firstuse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.