←back to thread

282 points bundie | 4 comments | | HN request time: 0.652s | source
Show context
yodon ◴[] No.44382371[source]
Pretty sure auth is not something I want a self-taught dev (or even most CS-graduate devs) writing.

Oauth2, JWT's, hashes, timestamps, validations, and such, are all totally simple until they're not. The black hats have way more experience and way more time invested in this space than most any normal dev.

replies(8): >>44382542 #>>44382600 #>>44382664 #>>44383532 #>>44383603 #>>44385107 #>>44385540 #>>44459701 #
vmg12 ◴[] No.44382542[source]
Auth is really not difficult to write. It's don't roll your own crypto, not don't roll your own auth. People need to stop spreading this fud.
replies(5): >>44382590 #>>44382617 #>>44383537 #>>44383587 #>>44383602 #
hobofan ◴[] No.44382617[source]
What? No!

There are plethora of mistakes one can make in implementing AuthN/AuthZ, and many of them almost immediately will lead to either the direct leak of PII or can form the start of a chain of exploits.

Storing password hashes in an inappropriate manner -> BOOM, all your user's passwords are reversible and can be used on other websites

Not validating a nonce correctly -> BOOM, your user's auth tokens can be re-used/hijacked

Not validating a session timestamps correctly -> BOOM, your outdated tokens can be used to gain the users PII

replies(4): >>44382637 #>>44382849 #>>44383269 #>>44383288 #
1. stephenr ◴[] No.44383269[source]
> Storing password hashes in an inappropriate manner

The problem isn't how you store the hash it's how you generate the hash.

replies(2): >>44383633 #>>44383825 #
2. gjsman-1000 ◴[] No.44383633[source]
The short answer: Bcrypt with 12 rounds.

Good enough for almost any startup in 2025.

replies(1): >>44386072 #
3. quacksilver ◴[] No.44383825[source]
Counterexample: Storing the bcrypt hash by appending it to a CSV file containing the usernames and hashes of all users then having a login process where that CSV file is downloaded to the client and the password is verified locally against that CSV file using client-side JavaScript would probably be very bad.

Cryptography part is fine but storage or the auth process isn't.

You would like to think that no-one would write their app that way, but there are plenty of slightly less worse things that happen in practice and vibe coding probably introduces all sorts of new silliness.

4. Intermernet ◴[] No.44386072[source]
Argon2 with defaults. Stronger and easier.