You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes test setup for bcrypt and django_bcrypt hashers by ignoring certain tests with bcrypt>=5.0.0, without changing any of the hashers themselves. @chapmajs, @mo7ty, would like you to take a look too - I don't really like current test setup (they even fail if you move a testcase class into a different module 👀), this may just come from being unfamiliar with underlying code, but I find it really hard to work with.
Hi @notypecheck,
Agree that you need to be familiar with the underlying code to understand the existing test setup, and not against this update, just need to be used to it. 😉
The new tests.test_handlers_bcrypt.test_known_hashes and test_with_truncate_size will then need to be updated in either #23 or #24 for proper changes validation.
Are #23 and #24 even needed? #23 introduces implicit truncation, which I don't really want, even if it's in line with how bcrypt<5.0.0 behaved, and #24 essentially does the same. As I mentioned previously I think it'll be better long-term to raise an error if users pass long password into default bcrypt hasher. bcrypt=5.0.0also seems to raise the same error when calling checkpw, I think this may be handled in passlib, so older password/hashes continue to work.
I agree that the tests are kind of a mess here! I have been reluctant to alter them significantly as there are security implications, given the nature of this library...but not doing so is just prolonging the problem. This commit is a good improvement.
If we're not going to force truncate when using bcrypt >= 5.0.0 we probably ought to set up TruncateMixin to raise on truncation by default.
We would still need to truncate in verify() to allow verification of hashes created with secrets exceeding 72 characters if TruncateMixin is configured to not reject on verify(). I don't see any way around truncating for that, though it could warn instead of doing so silently.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes test setup for
bcryptanddjango_bcrypthashers by ignoring certain tests withbcrypt>=5.0.0, without changing any of the hashers themselves.@chapmajs, @mo7ty, would like you to take a look too - I don't really like current test setup (they even fail if you move a testcase class into a different module 👀), this may just come from being unfamiliar with underlying code, but I find it really hard to work with.