Re: A word about CSRF Protection and AJAX

2011-02-26 Thread Paul McMillan
I'll chime in as opposed to forcing the cookie where not strictly necessary. It makes caching harder, and means that many of the dumber caching systems out there won't cache it at all (some mobile operators, smaller ISPs in lower GDP countries, etc.). Pushing the cookie to make AJAX easier seems es

Re: A word about CSRF Protection and AJAX

2011-02-25 Thread Ryan N
On Feb 25, 9:49 am, Luke Plant wrote: > Sorry, I forgot to continue this conversation. > > I'm quite happy to entertain the idea that the CSRF middleware should > always set the CSRF cookie, but would like to know what other devs > think. > > The main consequence I can think of is this: > > If a p

Re: A word about CSRF Protection and AJAX

2011-02-25 Thread Luke Plant
On Wed, 2011-02-23 at 15:23 -0800, Jonas Obrist wrote: > Well writing a middleware in my app or decorating all views seems a > little hacky/unclean to me too. > > In our specific use case, the django CMS the graceful degrading is > done through the admin, our so called frontend editing is heavil

Re: A word about CSRF Protection and AJAX

2011-02-23 Thread Jonas Obrist
Well writing a middleware in my app or decorating all views seems a little hacky/unclean to me too. In our specific use case, the django CMS the graceful degrading is done through the admin, our so called frontend editing is heavily javascript and AJAX base, without HTML forms. therefore we h

Re: A word about CSRF Protection and AJAX

2011-02-23 Thread Luke Plant
On Wed, 2011-02-23 at 05:07 -0800, Jonas Obrist wrote: > I beg to differ luke. > > > Most of our AJAX POSTs we do are actually not a 'form'. Because we > usually submit forms with 'normal' POST requests. I was suggesting that normally you would encounter at least one normal form before doing AJA

Re: A word about CSRF Protection and AJAX

2011-02-23 Thread Jonas Obrist
I beg to differ luke. Most of our AJAX POSTs we do are actually not a 'form'. Because we usually submit forms with 'normal' POST requests. What would be so terrible in just setting the cookie always? Jonas -- You received this message because you are subscribed to the Google Groups "Django

Re: A word about CSRF Protection and AJAX

2011-02-19 Thread Sayane
http://code.djangoproject.com/ticket/15354 2011/2/19 Luke Plant > On Sat, 2011-02-19 at 12:00 +0100, Sayane wrote: > > There's a problem with CSRF Protection and XHR requests. It works > > perfectly if 'csrftoken' cookie has been set already. But what if it's > > not? > > Cookie with token will

Re: A word about CSRF Protection and AJAX

2011-02-19 Thread Luke Plant
On Sat, 2011-02-19 at 12:00 +0100, Sayane wrote: > There's a problem with CSRF Protection and XHR requests. It works > perfectly if 'csrftoken' cookie has been set already. But what if it's > not? > Cookie with token will be set only, if META["CSRF_COOKIE_USED"] is > True [1]. It's set to True in f

A word about CSRF Protection and AJAX

2011-02-19 Thread Sayane
There's a problem with CSRF Protection and XHR requests. It works perfectly if 'csrftoken' cookie has been set already. But what if it's not? Cookie with token will be set only, if META["CSRF_COOKIE_USED"] is True [1]. It's set to True in function get_token() [2]. get_token() is called in CsrfRespo