Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#14156 closed (fixed)

CSRF protection in django.contrib.flatpages.views.flatpage causes unwanted behavior

Reported by: Patryk Zawadzki Owned by: nobody
Component: Contrib apps Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If you only decorate selected views with csrf_protect, any non-protected POST that ends up resulting in a 404 response returns 403 Forbidden instead.

This is both unwanted and potentially puzzling to developers. Either the flatpage view should not be decorated (it seems incapable of altering the application's state) or the above should be documented both in the CSRF section and in the flatpages section.

Change History (3)

comment:1 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

(In [13641]) Fixed #14156 -- Modified the way CSRF protection is applied to flatpages so that the flatpage middleware doesn't cause all POSTs resulting in 404s to turn into 403s. Thanks to patrys for the report.

comment:3 by Russell Keith-Magee, 14 years ago

(In [13643]) [1.2.X] Fixed #14156 -- Modified the way CSRF protection is applied to flatpages so that the flatpage middleware doesn't cause all POSTs resulting in 404s to turn into 403s. Thanks to patrys for the report.

Backport of r13641 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top