Skip Menu |

This queue is for tickets about the Catalyst-Plugin-Session-State-Cookie CPAN distribution.

Report information
The Basics
Id: 46556
Status: resolved
Priority: 10/
Queue: Catalyst-Plugin-Session-State-Cookie

People
Owner: bobtfish [...] bobtfish.net
Requestors: kmx [...] volny.cz
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] httponly cookie flag support proposal
Date: Sun, 31 May 2009 22:17:09 +0200
To: bug-Catalyst-Plugin-Session-State-Cookie [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Hi, please consider the enclosed simple patch for HTTPOnly flag support. The patch requires trunk version of Catalyst::Engine - see my commit: http://dev.catalystframework.org/svnweb/Catalyst/revision/?rev=10404 -- kmx ##### --- 0.11/lib/Catalyst/Plugin/Session/State/Cookie.pm +++ 0.11p/lib/Catalyst/Plugin/Session/State/Cookie.pm @@ -73,7 +73,6 @@ } $cookie->{secure} = 1 if $cfg->{cookie_secure}; + $cookie->{httponly} = 1 if $cfg->{cookie_httponly}; return $cookie; } @@ -225,16 +224,6 @@ If this attribute set true, the cookie will only be sent via HTTPS. +=item cookie_httponly + +If this attribute set true, the cookie will got HTTPOnly flag that should +prevent client side Javascript accessing the cookie value - this makes some +sort of session hijacking attacks significantly harder. Unfortunately not all +browsers support this flag (MSIE 6 SP1+, Firefox 3.0.0.6+, Opera 9.5+); if +a browser is not aware of HTTPOnly the flag will be ignored. + +This parameter is not supported with Catalyst::Runtime 5.80004 and before. + =item cookie_path The path of the request url where cookie should be baked.
Subject: Re: [rt.cpan.org #46556] [PATCH] httponly cookie flag support proposal
Date: Sun, 31 May 2009 15:57:22 -0500
To: kmx via RT <bug-Catalyst-Plugin-Session-State-Cookie [...] rt.cpan.org>
From: Jonathan Rockway <jon [...] jrock.us>
Good patch, although I think this should be *enabled* by default. If you want Javascript to steal your session cookies, you can set the config option manually. Regards, Jonathan Rockway On Sun, May 31, 2009 at 04:17:44PM -0400, kmx via RT wrote: Show quoted text
> Sun May 31 16:17:43 2009: Request 46556 was acted upon. > Transaction: Ticket created by kmx@volny.cz > Queue: Catalyst-Plugin-Session-State-Cookie > Subject: [PATCH] httponly cookie flag support proposal > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: kmx@volny.cz > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=46556 > > > > Hi, > > please consider the enclosed simple patch for HTTPOnly flag support. The > patch requires trunk version of Catalyst::Engine - see my commit: > http://dev.catalystframework.org/svnweb/Catalyst/revision/?rev=10404 > > -- > kmx > > ##### > --- 0.11/lib/Catalyst/Plugin/Session/State/Cookie.pm > +++ 0.11p/lib/Catalyst/Plugin/Session/State/Cookie.pm > @@ -73,7 +73,6 @@ > } > > $cookie->{secure} = 1 if $cfg->{cookie_secure}; > + $cookie->{httponly} = 1 if $cfg->{cookie_httponly}; > > return $cookie; > } > @@ -225,16 +224,6 @@ > > If this attribute set true, the cookie will only be sent via HTTPS. > > +=item cookie_httponly > + > +If this attribute set true, the cookie will got HTTPOnly flag that should > +prevent client side Javascript accessing the cookie value - this makes some > +sort of session hijacking attacks significantly harder. Unfortunately > not all > +browsers support this flag (MSIE 6 SP1+, Firefox 3.0.0.6+, Opera 9.5+); if > +a browser is not aware of HTTPOnly the flag will be ignored. > + > +This parameter is not supported with Catalyst::Runtime 5.80004 and before. > + > =item cookie_path > > The path of the request url where cookie should be baked. > >
Show quoted text
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> > <html> > <head> > </head> > <body bgcolor="#ffffff" text="#000000"> > <font face="Helvetica, Arial, sans-serif">Hi,<br> > <br> > please consider the enclosed simple patch for HTTPOnly flag support. > The patch requires trunk version of Catalyst::Engine - see my commit: > <a class="moz-txt-link-freetext" href="http://dev.catalystframework.org/svnweb/Catalyst/revision/?rev=10404">http://dev.catalystframework.org/svnweb/Catalyst/revision/?rev=10404</a><br> > <br> > --<br> > kmx<br> > <br> > #####<br> > --- 0.11/lib/Catalyst/Plugin/Session/State/Cookie.pm<br> > +++ 0.11p/lib/Catalyst/Plugin/Session/State/Cookie.pm<br> > @@ -73,7 +73,6 @@<br> >      }<br> > <br> >      $cookie-&gt;{secure} = 1 if $cfg-&gt;{cookie_secure};<br> > +    $cookie-&gt;{httponly} = 1 if $cfg-&gt;{cookie_httponly};<br> > <br> >      return $cookie;<br> >  }<br> > @@ -225,16 +224,6 @@<br> > <br> >  If this attribute set true, the cookie will only be sent via HTTPS.<br> > <br> > +=item cookie_httponly<br> > +<br> > +If this attribute set true, the cookie will got HTTPOnly flag that > should<br> > +prevent client side Javascript accessing the cookie value - this makes > some<br> > +sort of session hijacking attacks significantly harder. Unfortunately > not all<br> > +browsers support this flag (MSIE 6 SP1+, Firefox 3.0.0.6+, Opera > 9.5+); if<br> > +a browser is not aware of HTTPOnly the flag will be ignored.<br> > +<br> > +This parameter is not supported with Catalyst::Runtime 5.80004 and > before.<br> > +<br> >  =item cookie_path<br> > <br> >  The path of the request url where cookie should be baked.<br> > <br> > </font> > </body> > </html>
Nice patch, and I agree with jrockway... it should be enabled by default. Remind me when your Engine patch goes into a cat release and I will commit this patch to Session.
I'll ship this after Runtime 0006, which should be later this week.
0.12 released with this change. Many thanks for the patch!