<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Cookies and sessions in Rails 2.0</title>
	<atom:link href="http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/</link>
	<description></description>
	<pubDate>Thu, 28 Aug 2008 01:21:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: madpilot</title>
		<link>http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-620686</link>
		<dc:creator>madpilot</dc:creator>
		<pubDate>Sat, 02 Feb 2008 01:32:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-620686</guid>
		<description>Sorry about the formatting there, Looks like you can't use pre tags or br tags in comments...</description>
		<content:encoded><![CDATA[<p>Sorry about the formatting there, Looks like you can&#8217;t use pre tags or br tags in comments&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: madpilot</title>
		<link>http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-620683</link>
		<dc:creator>madpilot</dc:creator>
		<pubDate>Sat, 02 Feb 2008 01:26:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-620683</guid>
		<description>Hi Eric,

I've never had any problems with curl and sessions (cookie-based ones or otherwise), how ever, if you wanted to turn them off completely create a file called no_store.rb in the lib/ directory and drop this code in there:


&lt;code&gt;
require 'cgi'
require 'cgi/session'

class CGI::Session::NoStore
    def initialize(session, options = {}); end

    def restore
        {}
    end

    def update; end
    def close; end
    def delete; end
end
&lt;/code&gt;


then add this to you environment.rb file (Near commented out line about active_record_store):


&lt;code&gt;
require 'no_store'
config.action_controller.session_store = :no_store
&lt;/code&gt;


This is effectively a session store that does nothing, so technically cookies are still turned on, but they are disabled.

Hope that helps.

</description>
		<content:encoded><![CDATA[<p>Hi Eric,</p>
<p>I&#8217;ve never had any problems with curl and sessions (cookie-based ones or otherwise), how ever, if you wanted to turn them off completely create a file called no_store.rb in the lib/ directory and drop this code in there:</p>
<code>
require 'cgi'
require 'cgi/session'

class CGI::Session::NoStore
    def initialize(session, options = {}); end

    def restore
        {}
    end

    def update; end
    def close; end
    def delete; end
end
</code>
<p>then add this to you environment.rb file (Near commented out line about active_record_store):</p>
<code>
require 'no_store'
config.action_controller.session_store = :no_store
</code>
<p>This is effectively a session store that does nothing, so technically cookies are still turned on, but they are disabled.</p>
<p>Hope that helps.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Larson</title>
		<link>http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-620294</link>
		<dc:creator>Eric Larson</dc:creator>
		<pubDate>Fri, 01 Feb 2008 17:41:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-620294</guid>
		<description>I am wondering how turn this off as well, as programmable clients or curl don't easily work with the cookie bits. I'm writing a service that won't be used by a browser and won't use any cookies.</description>
		<content:encoded><![CDATA[<p>I am wondering how turn this off as well, as programmable clients or curl don&#8217;t easily work with the cookie bits. I&#8217;m writing a service that won&#8217;t be used by a browser and won&#8217;t use any cookies.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: m1ke</title>
		<link>http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-573029</link>
		<dc:creator>m1ke</dc:creator>
		<pubDate>Thu, 27 Dec 2007 16:21:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-573029</guid>
		<description>Is there a way of having rails NOT storing 127 chars for a session ID?  Sure, security is one thing, but let's assume that guessing 127 chars is pretty difficult for most rails apps out there.</description>
		<content:encoded><![CDATA[<p>Is there a way of having rails NOT storing 127 chars for a session ID?  Sure, security is one thing, but let&#8217;s assume that guessing 127 chars is pretty difficult for most rails apps out there.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: madpilot</title>
		<link>http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-565512</link>
		<dc:creator>madpilot</dc:creator>
		<pubDate>Sat, 22 Dec 2007 00:10:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-565512</guid>
		<description>Hi Don,

I stand corrected on that comment - I just went through the source code, and you you are right - it is just a base64 encoded version of a Marshalled object with a hashed digest that you can compare against.

As I said before - if you have any info in there that you didn't want sniffed, use one of the other stores.</description>
		<content:encoded><![CDATA[<p>Hi Don,</p>
<p>I stand corrected on that comment - I just went through the source code, and you you are right - it is just a base64 encoded version of a Marshalled object with a hashed digest that you can compare against.</p>
<p>As I said before - if you have any info in there that you didn&#8217;t want sniffed, use one of the other stores.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Don Park</title>
		<link>http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-565395</link>
		<dc:creator>Don Park</dc:creator>
		<pubDate>Fri, 21 Dec 2007 21:56:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-565395</guid>
		<description>"First of all, let me point out that the the store isn’t stored in plain text - there is a new forgery key in the environment.rb file"

a SHA is a one-way hash. the session is stored in the cookie in plain text along with the hash. any tampered-with session data is rejected, but the data itself is in plain view. (note i havent used cookie session store myself, this info comes from my reading on the topic)</description>
		<content:encoded><![CDATA[<p>&#8220;First of all, let me point out that the the store isn’t stored in plain text - there is a new forgery key in the environment.rb file&#8221;</p>
<p>a SHA is a one-way hash. the session is stored in the cookie in plain text along with the hash. any tampered-with session data is rejected, but the data itself is in plain view. (note i havent used cookie session store myself, this info comes from my reading on the topic)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: madpilot</title>
		<link>http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-540608</link>
		<dc:creator>madpilot</dc:creator>
		<pubDate>Fri, 07 Dec 2007 01:01:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-540608</guid>
		<description>wwb_99: Yes, this is a good point, although some may argue that if you are keeping that much data in the session, perhaps you should reconsider your flow. Having said that, if you do need to store a large amount of data in a session PStore probably isn't a good bet either, so you would be using one of the other solutions anyway.

Philippe: There has been a push on the core-dev list for a generator rake task - if that makes it through, there is no real reason to USE the default value. I'm of the opinion that you should generate your own key for each application.</description>
		<content:encoded><![CDATA[<p>wwb_99: Yes, this is a good point, although some may argue that if you are keeping that much data in the session, perhaps you should reconsider your flow. Having said that, if you do need to store a large amount of data in a session PStore probably isn&#8217;t a good bet either, so you would be using one of the other solutions anyway.</p>
<p>Philippe: There has been a push on the core-dev list for a generator rake task - if that makes it through, there is no real reason to USE the default value. I&#8217;m of the opinion that you should generate your own key for each application.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Philippe Rathe</title>
		<link>http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-539802</link>
		<dc:creator>Philippe Rathe</dc:creator>
		<pubDate>Thu, 06 Dec 2007 15:56:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-539802</guid>
		<description>Well as of today (december 5 2007), edge Rails generates a 127 bytes secret for the session.That's long. One week ago, edge rails was generating a 32 bytes secret.

My question is : Should we rely on the Rails generator for production if we choose CookieStore? Even if the generator seems good, it's still public.</description>
		<content:encoded><![CDATA[<p>Well as of today (december 5 2007), edge Rails generates a 127 bytes secret for the session.That&#8217;s long. One week ago, edge rails was generating a 32 bytes secret.</p>
<p>My question is : Should we rely on the Rails generator for production if we choose CookieStore? Even if the generator seems good, it&#8217;s still public.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: wwb_99</title>
		<link>http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-536989</link>
		<dc:creator>wwb_99</dc:creator>
		<pubDate>Wed, 05 Dec 2007 13:46:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/2007/12/05/cookies-and-sessions-in-rails-20/#comment-536989</guid>
		<description>Outside of the security issue, I can see another huge one--all your session variables got alot more expensive. A big part of the reason that people moved to sessions and away from cookies was that all that data was not pushed down to the client and back but rather remained on the server. So, depending on what you are keeping in the session, it could easily clobber your site.</description>
		<content:encoded><![CDATA[<p>Outside of the security issue, I can see another huge one&#8211;all your session variables got alot more expensive. A big part of the reason that people moved to sessions and away from cookies was that all that data was not pushed down to the client and back but rather remained on the server. So, depending on what you are keeping in the session, it could easily clobber your site.</p>]]></content:encoded>
	</item>
</channel>
</rss>
