News for hackers. Stuff that matters.
Re:Should I Use jwts For Authentication Tokens? by nine_k on Tuesday May 28, 2024 @01:37AM (#40497650)
Revocation is needed because you want to disable access to an intruder in the very second you detect unauthorized access using a stolen token. Same for certain kinds of banned users who must lose access immediately.

But since such a revocation list is going to be short (usually 0 entries, dozens at worst), it's trivial to replicate across all the auth service nodes (which can as well be worker nodes) or keep it in Redis replicated per DC, with sub-millisecond lookup times.

Things get harder if you want a feature like logging out other sessions, or just an explicit logout on a shared computer (think about business settings: stores, pharmacies, post offices), you may have to have larger revocation lists. This may still not be a problem: a million tokens is a few dozen megabytes, again, a per-DC replicated Redis cluster would handle it trivially and very cheaply.

Re:Should I Use jwts For Authentication Tokens? by torginus on Tuesday May 28, 2024 @02:18AM (#40497877)
I still feel like the need for revocation kills the simplicity of JWT and thus the reason for its existence.

I'm of a more gradual opinion regarding this - say you operate a movie streaming service and control access to movies via JWT. It's not a problem if an attacker has access for two more minutes than intended.

If you are talking to a single client, I think checking the remote IP address and encoding it in the token might work to see if the token is not stolen, but don't quote me on that.

Re:Should I Use jwts For Authentication Tokens? by g15jv2dp on Tuesday May 28, 2024 @10:53AM (#40501292)
It's a complicated problem. I don't see why it should have a simple solution.
Re:Should I Use jwts For Authentication Tokens? by stickfigure on Tuesday May 28, 2024 @10:31AM (#40501090)
> Revocation is needed because you want to disable access to an intruder in the very second you detect

I get that this has conceptual appeal, but I doubt this makes any difference in real life. Unless you have some very sophisticated infrastructure, it takes many minutes to discover the issue and then many more minutes even to decide what to do about it. A few extra minutes to cut off access is probably not going to make a big difference one way or another.

Re:Should I Use jwts For Authentication Tokens? by nine_k on Tuesday May 28, 2024 @02:53PM (#40504142)
An intruder might be not a sophisticated black hat hacker. It could be somebody who picked up an unlocked phone or keyboard.

When I had a chance to design a token-based authn/authz system, we had two types of tokens, general access (with hours of expiration, mostly read-only access) and privileged access, with expiration time set to a minute or so. All auto-refreshed on use, all separately revokable.

Re:Should I Use jwts For Authentication Tokens? by stickfigure on Wednesday May 29, 2024 @07:00PM (#40518111)
Sure, but isn't it still going to take you N minutes/hours/days to discover the violation? Does it make a material difference that you can revoke access this hot second as opposed to up-to-5-minutes when the token expires?

Seems to me that for most applications, the irrevocable 5-minute token seems "good enough".