Code

Opened 8 months ago

Closed 8 months ago

#21383 closed Cleanup/optimization (fixed)

Suspicious Operation Error Emails lacks request details

Reported by: anonymous Owned by: nobody
Component: Core (Other) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

While using the AdminEmailHandler to log errors the traceback (if available) and request information is included in the email when the BaseHandler handles the request. If the error is a SuspiciousOperation the request information is not included, instead the email just has "Request repr() unavailable.".

Including the request details in the logging call is a simple change and provides some useful details in what occurred. The change is in django/core/handlers/base.py on line 177:

            security_logger.error(force_text(e))

can be changed to

            security_logger.error(force_text(e), extra={'status_code': '400', 'request': request})

Attachments (0)

Change History (2)

comment:1 Changed 8 months ago by claudep

  • Component changed from Uncategorized to Core (Other)
  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/optimization

comment:2 Changed 8 months ago by Claude Paroz <claude@…>

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

In e6dd70b4dba3b7d812fecda7288c9707990ea71b:

Fixed #21383 -- Added request details in SuspiciousOperation messages

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.