News for hackers. Stuff that matters.
Re:JWT is Awesome by tmikaeld on Tuesday February 18, 2020 @08:53AM (#22356033)
If you cryptographically sign the session cookie, as suggested in the video, then you accomplish the exact same thing as a JWT token - so, then why use JWT at all, if you going to look up the session data from the database in any case.

JWT was meant to be stateless, if it's not, then it's just a layer of unnecessary complexity with potential security and implementation flaws.

Re:JWT is Awesome by blablabla123 on Tuesday February 18, 2020 @12:09PM (#22357598)
JWT is basically a spec for how to sign the session cookie. Correct me if I'm wrong but there are 2 fundamentally different ways to do user session management: a) user has a random key that can be compared to stored key (DB, Redis, ...) b) signed session information, probably stored as cookie.

It's possible to add additional information in a JWT. And of course it's complexity that adds additional attack surface, but at least there is some kind of standardization around it.

Re:JWT is Awesome by dwaite on Tuesday February 18, 2020 @06:38PM (#22361599)
Nit: JWTs are leveraged to cover a wide variety of use cases outside sessions.
Re:JWT is Awesome by to11mtm on Tuesday February 18, 2020 @07:48PM (#22362028)
My favorite use for JWT was actually on the backend for Frontend-to-service-to-service auth. It was actually a pretty natural way to flow the user context around without getting ugly with our API calling conventions.

Basically, Clients all used NTLM to talk to the main site, but the main site would use JWT to pass the authenticated user info to the other services being called. The signature ensured that you couldn't spoof, short of being an authorized user that could get an impersonate token for calling the APIs.

But the nice thing was it meant we didn't really have to hit the DB at all in any of this, and it was way cheaper to implement than an API gateway.

Re:JWT is Awesome by foray1010 on Tuesday February 18, 2020 @09:36AM (#22356336)
depends on if need to call other apis like microservices, you can use the JWT on behalf of the user to request the contents from other services. JWT also introduces `scope` which determine services user consented and allowed your backend to call. These things are not supported by a simple session cookie.
Re:JWT is Awesome by Spivak on Tuesday February 18, 2020 @09:50AM (#22356424)
I mean they're not supported OOB but you're just describing a session cookie with some signed metadata. If "the ecosystem" and interoperability with existing services is the goal then has the advantage.

If you're talking about something bespoke then it probably doesn't.

Re:JWT is Awesome by dwild on Tuesday February 18, 2020 @11:33AM (#22357213)
> you're just describing a session cookie with some signed metadata.

Isn't that JWT?

Re:JWT is Awesome by sk5t on Tuesday February 18, 2020 @10:27AM (#22356694)
Delegation via JWT replay downstream? Maybe, I guess, if those other services all have the same "aud(ience)" requirements, or don't bother checking audience. Probably not a design to hang one's hat on.
Re:JWT is Awesome by idoubtit on Tuesday February 18, 2020 @09:46AM (#22356400)
That's precisely the use case for JWT I recently had to work with, where cookies are irrelevant.

The web server gets a token from the API server, then prepares a few JSON messages that the web client will send asynchronously with JS. Since each message content is signed, the web client can't tamper with what is sent to the API. JWT was perfect for this 3-tiers messaging.

Re:JWT is Awesome by Spivak on Tuesday February 18, 2020 @09:53AM (#22356444)
I mean is all this complexity really worth "I can send data to an untrusted client so that it can later send it back to me?" compared to just storing that data somewhere like Redis?
Re:JWT is Awesome by Arnt on Tuesday February 18, 2020 @12:14PM (#22357661)
Then you have to provide a consistent view of the database across all server nodes, and the database updates need to propagate to all of your servers more quickly than the clients can issue requests. How complex is JWT compared to that?
Re:JWT is Awesome by Scarblac on Wednesday February 19, 2020 @03:20AM (#22363885)
He never said "back to me". Back to somewhere. That may or may not know that Redis exists.