Earlier quoted context omitted.
Hello bob! the checksum is for secret scanning offline and also for rejecting api keys which might have a typo (niche case) I just was confused regarding the JWT approach, since from the research I did I saw that it's supposed to be a unique string and thats it!
I may be naive but I can't imagine anyone typing an api key by hand. Optimizing for it sounds like premature optimization, surely stopping the less than one in a million HTTP request with a hand-typed API key from reaching the db isn't worth anything
My adventure in designing API keys
51–60 of 88 posts
Re: My adventure in designing API keys
#52Re: My adventure in designing API keys
#53Presumably because API keys are n bytes of random data vs. a shitty user-generated password we don’t have to bother using a salt + can use something cheap to compute like SHA256 vs. a multi-round bcrypt-like?
I can't understand what you are trying to say :o
Re: My adventure in designing API keys
#54Re: My adventure in designing API keys
#55Re: My adventure in designing API keys
#56It's a bit confusing that the "Random hex" example contains characters such as "q" and "p".
Re: My adventure in designing API keys
#57Well I would have done that and saved half the blog post.
Re: My adventure in designing API keys
#58Earlier quoted context omitted.
Hello bob! the checksum is for secret scanning offline and also for rejecting api keys which might have a typo (niche case) I just was confused regarding the JWT approach, since from the research I did I saw that it's supposed to be a unique string and thats it!
The neat thing about JWT is that there are no secrets to scan for. Your secret material ideally lives inside an HSM and never leaves. Scanning for these private keys is a waste of energy if they were generated inside the secure context.
Re: My adventure in designing API keys
#59Earlier quoted context omitted.
I may be naive but I can't imagine anyone typing an api key by hand. Optimizing for it sounds like premature optimization, surely stopping the less than one in a million HTTP request with a hand-typed API key from reaching the db isn't worth anything
if not for typo, then I can use for secret scanning then :)
Re: My adventure in designing API keys
#60While it's true that API keys are basically prefix + base32Encode(ID + secret), you will want a few more things to make secure API keys: at least versioning and hashing metadata to avoid confused deputy attacks. Here is a detailed write-up on how to implement production API keys: https://kerkour.com/api-keys
I don’t understand your explanation on mitigating the confused deputy. If the attacker has access to the database, can’t they just read the IDs for the target row they are overriding first so they can generate the correct hash?