🥅 Workaround for faulty argon2 hashes on aarch64 (#4780)
Ensure we can successfully verify an argon2 hash before using it. Closes #4779
This commit is contained in:
1 parent
c4fab1b7e6
commit
cf86f08d04
3 files changed
+16
-1
No files matched your search
@@ -176,6 +176,7 @@ date of first contribution):
|
|||||||
* [Moiz Rasheed](https://github.com/msrasheed)
|
* [Moiz Rasheed](https://github.com/msrasheed)
|
||||||
* [Scott Martin](https://github.com/smartin015)
|
* [Scott Martin](https://github.com/smartin015)
|
||||||
* [Shyam Sunder](https://github.com/sgsunder)
|
* [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
|
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
|
[Daid Braam](https://github.com/daid). Parts of its communication layer and
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ try:
|
|||||||
|
|
||||||
# test if we can actually hash and verify, if not we won't use this backend
|
# test if we can actually hash and verify, if not we won't use this backend
|
||||||
hash = argon2.hash("test")
|
hash = argon2.hash("test")
|
||||||
argon2.verify("test", hash)
|
assert argon2.verify("test", hash)
|
||||||
|
|
||||||
password_hashers.append(argon2)
|
password_hashers.append(argon2)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@@ -21,3 +21,17 @@ class UserManagerTest(unittest.TestCase):
|
|||||||
|
|
||||||
# should not throw an exception
|
# should not throw an exception
|
||||||
octoprint.access.users.UserManager.create_password_hash(password)
|
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))
|
||||||
Reference in new issue
Block a user