Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken implementation of import_from_firstuse #221

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

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.
@consideRatio consideRatio changed the title fixes #219 Fix broken implementation of import_from_firstuse May 8, 2023
@consideRatio consideRatio added the bug Something isn't working label May 8, 2023
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
None yet
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