News for hackers. Stuff that matters.
Re:Stop using JWT for sessions (2016) by scient on Thursday November 01, 2018 @10:47AM (#18354361)
Except cookies are quite literally perfect for that - set the expiration to 30 minutes from issuance and it will automatically be expired with inactivity. Or bumped on activity.
Re:Stop using JWT for sessions (2016) by deathanatos on Thursday November 01, 2018 @10:54AM (#18354432)
You shouldn't be trusting the client to expire your sessions for you. (That is, relying on a cookie's expiration to actually expire the session.)

(Now, if you mean looking up a session token in a database and checking that for expiry, then yes, that works, but the only real difference between JWT and tokens then is the latter requiring a database query.)

Re:Stop using JWT for sessions (2016) by yen223 on Thursday November 01, 2018 @11:10AM (#18354631)
The more important difference between JWT and tokens is that the former requires you to trust that your encryption mechanism is foolproof, whereas the latter doesn't.
Re:Stop using JWT for sessions (2016) by deathanatos on Thursday November 01, 2018 @12:53PM (#18355941)
Session tokens (an unguessable identifier that identifies server-side stored session data), while they don't need to be encrypted or signed, the identifier should usually be cryptographically random, however, so you can still get into trouble there.

JWTs don't have to be encrypted. (And IME, typically aren't.) They need to be signed, but the algorithms that do this are common, well-understood algorithms. Some of them are likely being used by TLS to protect your session anyways. If they're not foolproof, you have bigger issues than JWT.

If you are referring to the implementation, then sure, but the same concerns exist about your implementation of TLS, and the same advice applies: use a well-known, hopefully well tested library.

Re:Stop using JWT for sessions (2016) by nbevans on Thursday November 01, 2018 @10:58AM (#18354469)
Cookies are implementation dependent. It's quite possible that a user agent doesn't honour what you instructed it to do regarding the expiration of a cookie.

JWT however... your server side can validate its own token in whatever ways it wants (including expiration). You can't get more secure than that.

Re:Stop using JWT for sessions (2016) by icebraining on Thursday November 01, 2018 @12:06PM (#18355356)
If you checking the session on the server, you might as well just use a token in a cookie. The point of the JWT complexity is to avoid that.
Re:Stop using JWT for sessions (2016) by nbevans on Friday November 02, 2018 @09:16AM (#18362764)
JWT tokens being passed via cookies is a valid use case.