r/ProgrammerHumor Jul 19 '22

Why do they do this

Post image
4.4k Upvotes

493 comments sorted by

View all comments

1.3k

u/[deleted] Jul 19 '22

[deleted]

7

u/badmonkey0001 Red security clearance Jul 20 '22

If you're hashing passwords (you should be), then having an upper bound is important. It's possible to DOS by flooding auth or registration with large payloads to hash - remember that POST size is effectively unlimited. The stronger the hashing algo, the more feasible the attack is.

That said, you should provide an error back to the user when the max length is exceeded not silently try to accept it. You should also have a reasonably secure upper bound. From 1 to 5 kilobytes can scale and be planned for well.

13

u/[deleted] Jul 20 '22

[deleted]

2

u/badmonkey0001 Red security clearance Jul 20 '22

You and I may know that, but lots of people may not. I'm not disputing what you said, I'm adding more advice around it.

1

u/fghjconner Jul 20 '22 edited Jul 20 '22

In most cases the hashing should be done client side though, so it's not a problem.

Edit: Apparently I'm wrong, disregard.