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

upgrade to argon password hasher #3410

Closed
wants to merge 1 commit into from
Closed

Conversation

sinwar
Copy link
Contributor

@sinwar sinwar commented Jan 20, 2017

Fixes #3362

@smarx
Copy link

smarx commented Jan 20, 2017

Automated message from Dropbox CLA bot

@sinwar, it looks like you've already signed the Dropbox CLA. Thanks!

@@ -489,6 +489,7 @@ def get_secret(key):
# Use fast password hashing for creating testing users when not
# PRODUCTION. Saves a bunch of time.
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.Argon2PasswordHasher',
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This config is only used in development! This will just make the tests run slow.

@@ -490,12 +490,23 @@ def get_secret(key):
# PRODUCTION. Saves a bunch of time.
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.SHA1PasswordHasher',
'django.contrib.auth.hashers.PBKDF2PasswordHasher'
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.Argon2PasswordHasher'
Copy link
Contributor Author

@sinwar sinwar Jan 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I included argon here for checking because it is preferred in production.

@sinwar sinwar force-pushed the pswrdhash branch 8 times, most recently from e71053c to 3f232d1 Compare February 3, 2017 01:34
@@ -496,6 +496,11 @@ def get_secret(key):
# can query using ./manage.py print_initial_password
INITIAL_PASSWORD_SALT = get_secret("initial_password_salt")

# Use best password hashing algorithm argon2 for PRODUCTION
if PRODUCTION:
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be an else.

# Use best password hashing algorithm argon2 for PRODUCTION
if PRODUCTION:
PASSWORD_HASHERS = ('django.contrib.auth.hashers.Argon2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2PasswordHasher')
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment that Zulip was originally on PBKDF2 so we need it for compatibility, but we're now defaulting to Argon2?

@timabbott
Copy link
Sponsor Member

@sinwar how carefully have you tested this? Ideally, one would enable password auth locally on master (zproject/dev_settings.py), register a new account with password, and then apply this change, and verify:
(1) That new account can still login
(2) That new account can change password
(3) We can register an additional account with password auth
(4) That second new account can login.
(5) If we then revert to the original code, now that second account can't login (aka a failing test of the upgrade).

@sinwar
Copy link
Contributor Author

sinwar commented Feb 13, 2017

@timabbott I verified for all the test cases.

@@ -495,6 +495,11 @@ def get_secret(key):
# Also we auto-generate passwords for the default users which you
# can query using ./manage.py print_initial_password
INITIAL_PASSWORD_SALT = get_secret("initial_password_salt")
else:
# Use best password hashing algorithm argon2 for PRODUCTION
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the algorithm is called "Argon2" then - for ease of grepping - we should call it that in this comment as well:

For production, use the best password hashing algorithm: Argon2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok @brainwane changing it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sinwar, have you updated this?

@umairwaheed
Copy link
Member

So I have verified this and it works for all the cases mentioned above. The only observation I want to make is that for the tests to pass in the development environment, I had to do vagrant provision.

@umairwaheed
Copy link
Member

The only observation I want to make is that for the tests to pass in the development environment, I had to do vagrant provision.

I see that we are not planning to use this hasher in our tests.

@sinwar
Copy link
Contributor Author

sinwar commented Feb 20, 2017

@umairwaheed this will slower down our test so we are not planning to use in development.
for production I made changes as @timabbott and @brainwane suggested.

@umairwaheed
Copy link
Member

Cool. Lgtm!

@sinwar
Copy link
Contributor Author

sinwar commented Feb 22, 2017

the production tests were not working yesterday. I think now we should run it again. It seems to pass all test.

@timabbott
Copy link
Sponsor Member

Merged, after adding a PROVISION_VERSION update. Thanks @sinwar!

@timabbott timabbott closed this Feb 23, 2017
andersk added a commit to andersk/zulip that referenced this pull request May 14, 2021
This changed in commit 483a351
(zulip#3410).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
timabbott pushed a commit that referenced this pull request May 14, 2021
This changed in commit 483a351
(#3410).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants