The question is, how does Rails deal with session when the user’s browser does not accept cookies? In a J2EE app, the app server does URL rewriting to attach a session id to the URL. Does Rails do anything similar?
I’d love to see a patch for this—companies in the security software business have done a great job of scaring people away from cookies, it’s a major hassle but we have to deal with it. —GreasyP?
try Hidden Field Session Plugin.
Well, the wisdom on IRC is that you need to require cookies.
e.g. ror.log.20041120:
nextangle jcfischer: You can pass the session id around every where. But it’s quite a pain. Why don’t you want to require cookies?(You can’t use Basecamp if you don’t use cookies)
I think they’re right, but I’m still going to write the patch. —p13d
2008-03-18 – encoding session id in the URL can be quite painless and there is a Plugin written specifically for this purpose. A write up is available here: Rails No-Cookie Session Support Plugin
You are welcome to use the code in the patch if it will be of use.
—Long
There is at least one legitimate reason for not wanting cookies: some people (me for example) do not want to be tracked across multiple web pages by advertisers. I refuse to use web pages (bank sites excluded) that take the easy way out and require cookies. [Totally ignoring the fact that you can also be tracked with their logs.] (Totally ignoring the fact that cookies are persistent with most advertising sites setting an expiration date 100 years from now. With an IP address, companies have to assume that it changes (as most home internet connections have dynamically allocated addresses) making it more privacy friendly.)
Simple web browsers on some cell phones don’t even seem to support cookies, so in the case of my app I’ve simplified what was going to be stored in the session, and passed around the few remaining variables as URL parameters. —Dan W.
There is at least one other reason against cookies (for session-ids). They are affected by an almost unknown vulnerability, called “Session Riding”. So please consider at least an optional GET based mode. —Patrick Gupta
And if you think this risk is enough to still warrant even reading my words, there are easier ways to get around it:
-Simon Wex
People who are 100% against cookies also wear foil hats. It’s also quite easy to selectively block specific cookies with browsers like Firefox. There’s also a security risk with having URLs with sessions IDs in them, which nobody has mentioned.
The point here is that this is supposed to be a howto on maintaining sessions without cookies, not a howto on telling someone what they can’t do.
How would one go about detecting if cookies are enabled? My authentication scheme dies hard if the remote browser has cookies disabled (something I should fix anyway), but I’d still like to be able to detect the absence of cookies and give an informative error message.
One mitigating factor not mentioned in the link above is Referer-verification. Do any of the Authentication frameworks actually support defining the allowed source urls/actions for each action to be performed?
-Jügen Strobel