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

workaround for faulty argon2 hashes #4780

Merged
merged 1 commit into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ date of first contribution):
* [Moiz Rasheed](https://github.com/msrasheed)
* [Scott Martin](https://github.com/smartin015)
* [Shyam Sunder](https://github.com/sgsunder)
* [Christopher Perrin](https://github.com/cperrin88)

OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
[Daid Braam](https://github.com/daid). Parts of its communication layer and
Expand Down
2 changes: 1 addition & 1 deletion src/octoprint/access/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# test if we can actually hash and verify, if not we won't use this backend
hash = argon2.hash("test")
argon2.verify("test", hash)
assert argon2.verify("test", hash)

password_hashers.append(argon2)
except Exception:
Expand Down
14 changes: 14 additions & 0 deletions tests/access/users/test_usermanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,17 @@ def test_createPasswordHash_nonascii(self):

# should not throw an exception
octoprint.access.users.UserManager.create_password_hash(password)

def test_createPasswordHash_is_valid(self):
password = "test1234"
password_hash = octoprint.access.users.UserManager.create_password_hash(password)
user = octoprint.access.users.User(
"username",
password_hash,
True,
permissions=[],
apikey="apikey",
settings={"key": "value"},
)

self.assertTrue(user.check_password(password))