Code

Opened 4 years ago

Closed 4 years ago

Last modified 4 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.

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by russellm

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

comment:2 Changed 4 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 4 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.