From: Benjamin Slavin <benjamin.sla...@gmail.com>
Date: Thu, 24 Sep 2009 15:22:37 -0400
Local: Thurs, Sep 24 2009 3:22 pm
Subject: Re: Adding signing (and signed cookies) to Django core
The lack of parallelism in terms of the interface is my biggest hangup here.
I do think that this should find it's way into trunk, as signed I'm not going to get into the dumps/loads bit right now because On Thu, Sep 24, 2009 at 2:54 PM, Simon Willison <si...@simonwillison.net> wrote: Unfortunately, this approach won't work. > Hmm... I hadn't considered that. I was thinking that the unsigning > could be transparent, so by the time you access request.COOKIES['key'] > the value had already been unsigned (and if the signature failed the > cookie key just wouldn't be set at all, as if the cookie never > existed). But as you point out, this doesn't work because you can't > tell if the cookie was signed or not in the first place. > We could fix this with a naming convention of some sort: > response.set_cookie('key', 'value', sign=True) A malicious client can just send "key" rather than "key__Xsigned" and As always, we can't trust the client. :-( This means that unsigning can *never* be fully transparent. We need a > But that's pretty ugly. Not sure what to do about this one - I'm not sure what the best solution is, but here are some of the > request.unsign_cookie('key') might be an option, as at least that > reflects the set_cookie / sign / unsign API a bit. Not ideal by a long > shot though. options I've considered: 1) request.unsign_cookie('foo') -- This breaks the parallelism with 2) A decorator for views -- @unsign_cookies("foo", "bar") -- This 3) COOKIES as an intelligent object -- We can overload .get so we're Best, You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||