From: Marty Alchin <gulop...@gmail.com>
Date: Thu, 24 Sep 2009 15:48:55 -0400
Local: Thurs, Sep 24 2009 3:48 pm
Subject: Re: Adding signing (and signed cookies) to Django core
On Thu, Sep 24, 2009 at 3:22 PM, Benjamin Slavin
<benjamin.sla...@gmail.com> wrote: And you've just added another reason my followup email is invalid, >> response.set_cookie('key', 'value', sign=True) >> - results in a Set-Cookie: key__Xsigned=value header > Unfortunately, this approach won't work. > A malicious client can just send "key" rather than "key__Xsigned" and > As always, we can't trust the client. :-( though I sent that before reading your response. (Take that, future me!) > 3) COOKIES as an intelligent object -- We can overload .get so we're I was wondering about this option as well, after I mentioned adding a > doing something like request.COOKIES.get('foo', signed=True) -- I > think this has the best chance at an interface that keeps a consistent > feel. It's completely backward compatible, though it breaks the > traditional expectation of what you can do via the `get` method on a > dictionary. request.COOKIES.get_unsigned() method. I actually like this idea a lot, personally. As you mention, it's backward compatible, and I'm not sure it completely breaks the traditional expectation. After all, aren't subclasses expected to customize the behavior of their parents? It doesn't change any existing behavior, but rather just adds something extra. The one downside to using get() directly, as opposed to an altogether -Gul 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.
| ||||||||||||||