News for hackers. Stuff that matters.
Re:JSON Web Tokens should be avoided by jchw on Tuesday March 14, 2017 @10:34AM (#13867762)
What's difficult about setting up a Redis cluster to back sessions? Yes, it adds a point of failure... so does having a database of any kind. However, I'd hardly call it difficult. If you're on Amazon, you can just create an Elasticache cluster and not even concern yourself with the ops.

I don't hate secure cookies or anything, but some people act like plain-old regular cookies haven't been thoroughly solved by this point.

Related: Something people get wrong a lot with secure cookies is worrying about obscuring the cookie more than securing it. Encryption does not give you authentication; you need MAC for that. An encrypted message can still be blindly modified. Imagine being able to change a UID stored in a "secure" cookie even if you couldn't 100% control which. Eventually, if you try enough permutations, you're going to escalate your privileges!

Re:JSON Web Tokens should be avoided by jdmichal on Tuesday March 14, 2017 @11:09AM (#13868063)
Nothing's difficult about that. But that doesn't mean that it's a good idea. How about distributing a signature and encryption key to all your servers, and using them to secure the outgoing and verify the incoming tokens. If you want easy, that's probably even easier than setting up a Redis store and tying your services to it.

Need an emergency revoke of every token? Easy: Replace your signature key. Any older token will fail signature verification. In which case, your system should require authentication and then generate a new token with an updated signature.

Re:JSON Web Tokens should be avoided by batoure on Tuesday March 14, 2017 @01:12PM (#13869414)
Here is the use case that lead to the first implementation of JWT I was ever part of.

You have a single page webapp that uses two APIs for part of the application. For security reasons the APIs are zoned in such a way that neither of them can communicate with each other. The machine of the user sits in a zone where it can send HTTP requests to the zones of either API.

Now design a way to manage sessions across both APIs...

There are certainly a number of ways to accomplish this, but JWT was the cleanest and most performant.

Re:JSON Web Tokens should be avoided by chmike on Tuesday March 14, 2017 @11:29AM (#13868279)
When the authentication info needs to be used with servers in different location of the world, JWT is better. Getting the session info from a redis server or something equivalent isn't free. Deciphering a JWT token may be faster. So, the most appropriate method depends on the use case.

If all the servers are in one location, a random byte sequence as session id key with cached info is the most simple, compact and efficient.

Re:JSON Web Tokens should be avoided by jjawssd on Tuesday March 14, 2017 @11:57AM (#13868609)
Or you can use read only Redis replication and keep your architecture pretty much the same https://redis.io/topics/replication
Re:JSON Web Tokens should be avoided by daenney on Tuesday March 14, 2017 @12:52PM (#13869191)
What happens when that replication breaks? Can people still log in? Can you still validate their sessions? Or are you going to have an outage in a geographical region?
Re:JSON Web Tokens should be avoided by jjawssd on Tuesday March 14, 2017 @01:30PM (#13869585)
Fall back to connecting to the main instance directly
Re:JSON Web Tokens should be avoided by tracker1 on Tuesday March 14, 2017 @02:19PM (#13870022)
And if the replication is down because the main instance can't be reached for a minute?
Re:JSON Web Tokens should be avoided by jjawssd on Tuesday March 14, 2017 @07:49PM (#13872630)
And if your user base is hit by a nuclear bomb?
Re:JSON Web Tokens should be avoided by stephenr on Wednesday March 15, 2017 @01:36PM (#13878042)
The problem is you're suggesting real-world, ops-capable solutions to a problem "Devops" (as in, developers can do it, we don't need ops) people don't want to understand because they'd rather jump on yet another poorly designed "solution" to a problem they don't really have.
Re:JSON Web Tokens should be avoided by tracker1 on Tuesday March 14, 2017 @02:17PM (#13870003)
JWT signature verification usually takes less time than the network request to a redis server... assuming it's non-local, because HA.
Re:JSON Web Tokens should be avoided by jchw on Wednesday March 15, 2017 @12:54PM (#13877567)
I'll just say this: if the most expensive part of your API is calling Redis, it probably doesn't have anything worth authenticating for in the first place.