#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})

Change History (2)

comment:1 Changed 18 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 18 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

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