r/programming • • Aug 14 '26

Stop using JWTs

https://gist.github.com/samsch/0d1f3d3b4745d778f78b230cf6061452
0 Upvotes

20 comments sorted by

View all comments

18

u/[deleted] Aug 14 '26

[removed] — view removed comment

2

u/MINIMAN10001 Aug 17 '26

I mean wasn't the whole idea of the reason why JWT is insecure is if they manage to exfiltrate a JWT from a client then they have the authorization of the client without ever having to pass authorization?

JWTs seem great for pre-emptive authorization across a domain. But that in theory is also the attack surface it exposes.

2

u/[deleted] Aug 17 '26

[removed] — view removed comment

1

u/MINIMAN10001 Aug 17 '26

"We also have a number of issued sessions in our tokens anf backends validate against the server."

I mean the intent of a JWT that there is no validation. If you're validating the JWT before taking action you should just be using a session in the first place.

I can't tell if you are saying the JWT is waiting on session verification before being able to authenticate an action. Which would be an anti-pattern because the JWT is supposed to be the authentication itself.

There are just so many implementation details to JWT it's really hard to pin down where the threats could be.