Skip to content

Commit e5377b7

Browse files
committed
Fixing direct call to bcrypt library in test_handlers_bcrypt, truncating secret in fuzzer to avoid raising an error, adding more verbosity when an error is raise
1 parent a3f920f commit e5377b7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tests/test_handlers_bcrypt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ def check_bcrypt(secret, hash):
220220
hash = IDENT_2B + hash[4:]
221221
hash = to_bytes(hash)
222222
try:
223-
return bcrypt.hashpw(secret, hash) == hash
224-
except ValueError:
225-
raise ValueError(f"bcrypt rejected hash: {hash!r} (secret={secret!r})")
223+
return bcrypt.hashpw(secret[:72], hash) == hash
224+
except ValueError as e:
225+
raise ValueError(f"bcrypt rejected hash: {hash!r} (secret={secret!r}) with message: {str(e)}")
226226

227227
return check_bcrypt
228228

0 commit comments

Comments
 (0)