On my application, I have a User model (extended with other fields) and the password field has not been overridden (so its max-length is the default of 128).
I’ve never had a problem with login pages but today I got an error on login where a value is too big. (Stacktrace ended with this line as the culprit as Django proceeded to update a hash on login).
In my User table, all existing password hashes were of length 119.
New logins are now producing hashes of length 140 (exceeding the 128 limit).
The only thing I have done differently since my last successful login was update Django from v4.2.1 to v4.2.5 (but it’s not a version issue as I reinstalled my previous version and got the same behaviour).
The salt-entropy is increased from the default but that change was 2 years ago and I’ve had successful logins all this time.
I know my fix is to override the password field and set a higher max-length but I’m curious over why the length-increase happened? If it’s possible, I want to prepare for future hash-length-increases (should I set the password max-length to be higher than my salt-entropy value?). This is probably down to my lack-of-knowledge on Django’s password management docs.
Is there a correlation between what I set as the salt-entropy and what should be the password max-length? (Default salt-entropy is 128 in BasePasswordHasher which matches the default password length)
If not, yes, I will keep in mind something in my code/environment could be at play here and will consider seeing if I can reproduce this in a smaller example.