Opened 3 years ago

Closed 3 years 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})

Change History (2)

comment:1 Changed 3 years ago by Claude Paroz

Component: UncategorizedCore (Other)
Needs tests: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

comment:2 Changed 3 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In e6dd70b4dba3b7d812fecda7288c9707990ea71b:

Fixed #21383 -- Added request details in SuspiciousOperation messages

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