Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#14156 closed (fixed)

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

Reported by: patrys 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: UI/UX:

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 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 Changed 5 years ago by russellm

(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