--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
If you have a Django 1.1 project that you have upgraded to 1.2, then
CSRF protection will *not* be enabled by default. In order to enable
it, you need to follow the migration instructions in the 1.2 release
notes.
The exception to this rule is the admin site; the admin site has CSRF
protection turned on, and no, it can't be turned off. We have
intentionally added CSRF protection as a non-optional part of the
admin as a safety mechanism. Django's admin app is a common and highly
visible component of Django projects, and as a result, it is a likely
target for any malicious activity. Forcing CSRF protection on the
admin is our way of ensuring that Django's admin site is not the
vector used to attack a Django site.
Yours,
Russ Magee %-)
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
Depends on the operation of your proxy cache. If it's not handling
cookies correctly, then this could be the source of your problem.
At it's core, the CSRF process is simple. You visit a view. Your
browser gets a CSRF cookie set. You submit a form. That form
submission must provide the CSRF token as a form element. If the csrf
token on the submitted form does not exist, or doesn't match the
cookie, the form submission is rejected as a CSRF failure.
There are really only three things that can go wrong in the CSRF process:
* The cookie wasn't set when the form was originally requested
* The cookie isn't submitted along with the POST request
* The form data doesn't contain the CSRF token.
As I've said in other threads recently, we (the Django core team) take
backwards compatibility *very* seriously. We are not aware of any
backwards compatibility problems in Django 1.2, caused by the CSRF
framework or otherwise. We believe the release notes document all the
possible problems you may encounter as part of the upgrading process.
If you can provide any evidence to the contrary, we would consider it
a major flaw, and it would almost certainly simulate a point release
to correct the problem.
Yours,
Russ Magee %-)
Suffice to say, this isn't a problem that we have seen during release
testing. Any assistance you can provide in tracking this problem would
be gratefully received.
Yours,
Russ Magee %-)
You're going to need to provide more detail than that.
Django has an extensive test suite, and it's currently passing without errors.
We have a very large userbase that has deployed Django 1.2 and not
reported any problems.
I have personally run many dozens of manual tests, including changing
a user's password, and have had no problems.
Allow me to assure you that we have tested this. If you are
experiencing problems, then there is something unusual going on, and
we need as much detail as possible. "It doesn't work" doesn't help us.
Exact browsers configurations, server configurations, minimal sample
projects -- these are the things that will help us identify and fix
this problem. We can't help you until we can duplication your problem.
Yours,
Russ Magee %-)
Hi,
I'm not sure what your specific problem might be, but I experienced
CSRF problem in admin in 2 situations:
- cookies disabled in browser for the site (and long forgotten by me :)
- running admin on SSL-enabled site and having faulty browser addin
that was stripping referer values even for SSL sites.
HTH
Jirka
Agreed - which means it's not a complex browser issue, it's a
configuration issue with your Django project. At first guess, either:
* Your TEMPLATE_DIRS setting is pointing to a directory with pre-1.2 templates
* Your Django install is running pre-1.2 code, or using stale pyc
files (which might mean you're loading templates from the wrong app
directory)
* You have overridden the auth/user/change_password.html template
* You have installed an app that overrides the
auth/user/change_password.html template
To demonstrate the point -- go to the Django install that you think
you are using, and change the
django/contrib/admin/templates/admin/auth/user/change_password.html
template, putting in some dummy content (e.g., "I WAS HERE") at the
top of the form where the CSRF token should be. Then re-render the
form. If you don't get your new content, then you've found the problem
-- you're not rendering the template you think you are.
Yours,
Russ Magee %-)
I've seen some strange errors with Django and python 2.4 on RHEL 5.x.
Solution for me was to deploy the same code on fedora using python 2.5
or higher.
Matthias
It seems I haven't expressed myself clearly enough.
The template django/contrib/admin/templates/admin/auth/user/
change_password.html You point me to is rendered when I use the
password change form from user change form.
The one that seems to be missing CSRF token is rendered when I try to
change password from the link in the upper right corner of admin
screen.
I think that it is some other template, as the form's fields ids are
different - namely id_old_password, id_new_password1 and
id_new_password_2, while in the aforementioned template the form's
fields ids are id_password1 and id_password2.
I think that the template rendered in this case is django/contrib/
admin/templates/registration/password_change_form.html
Is this something I can change and if so then how?