There is of course some performance overhead to encrypting, but Felipe's skein package has been highly optimized, and Yesod is still able to achieve ~50,000 req/sec on modest hardware. (Apologies for not having more accurate numbers, I haven't run our benchmark suite on EC2 in over a year.)
- Someone who hijacks a request with the cookie in it cannot see the data in the cookie. But they can access the site as the user, so there is no real world benefit to this fact. - Someone on the same computer cannot see the data in the cookie. But again, they have the cookie value, so they can access the site as the user, so there is again no real world benefit to the fact that they can't see the data in the cookie itself, because they can interact with the site and see the data there.
I guess I'm just looking for an example scenario where the cookie being encrypted offers a concrete benefit from a security standpoint.
Could be wrong here, I'm not very familiar with Yesod.
the encryption prevents reading (and thereby also -- to some extend -- but not specifically tinkering/tampering)
i'd cannot think of a web app i worked on where this was needed.
(the hashing is cool though -- tinker prevention is common to be a-good-thing)
And yes, some sort of HMAC is pretty much mandatory if you're going to do client-side session storage securely, no question.
It's useful for things like storing the current user session. You wouldn't want someone to be able to log in and then change their account to someone else's by modifying the user id in their cookie. Thus this information is often stored in a server-side session. With an encrypted cookie you can push this data to the client, which makes the server stateless with respect to client sessions.
(2) If someone has your cookie, they're either already on your connection or they're on your computer.
(3) The only situation where this provides any security is one in which you store data in the cookie that would not be accessible to the same user through the site. I can't think of any such data in any of my experience, but I will absolutely grant that such data may exist.
> If properly encrypted with an authenticated encryption mechanism
(2) Being on one's connection is the default assumption of the internet security model.
(3) Right, the confidentiality of the site's data from the site's user may not be critical. But if done properly it does allow the site to ensure that the data it stored has not been tampered with (except perhaps to drop it or replay it). Surely this can be useful.