News for hackers. Stuff that matters.
Re:Sudo Replacement by Xylakant on Saturday January 21, 2023 @03:30AM (#34464871)
I would consider setting a (high) limit for a password a good practice. No one wants an attacker to run a megabyte of password data through your slow password hash. It should be a limit that normal users never reach, but something like 100 chars seems entirely reasonable.
Re:Sudo Replacement by BrandoElFollito on Saturday January 21, 2023 @08:44AM (#34466355)
The typical password managers allow you to generate up to ~120 characters, I would go for 500 just to be on the safe side.
Re:Sudo Replacement by intuxikated on Saturday January 21, 2023 @08:52AM (#34466391)
Some web frameworks have such limits built-in. Django for example has a limit of 4096 characters for password input, which should be more than enough for anyone, including people using long random-generated passwords from password managers
Re:Sudo Replacement by afiori on Saturday January 21, 2023 @03:06PM (#34469841)
The reasonable thing to do is to prehash the user password on the client with a Unicode normalization and a SHA-512 pass.

This way you can have strong input validation server side but also allow almost arbitrary inputs client side.

PS: you likely could also salt the client side hashing and use bcrypt, but bcrypt has a quite short maximum length and I am not sure if it would provide significantly better security here.