#17281: AdminErrorHandler silently fails if the log message contains newlines
----------------------------------------+------------------------
               Reporter:  russellm      |          Owner:  nobody
                   Type:  Bug           |         Status:  new
              Component:  Core (Other)  |        Version:
               Severity:  Normal        |       Keywords:
           Triage Stage:  Accepted      |      Has patch:  0
    Needs documentation:  0             |    Needs tests:  0
Patch needs improvement:  0             |  Easy pickings:  1
                  UI/UX:  0             |
----------------------------------------+------------------------
 If you have loggers configured with an django.utils.log.AdminEmailHandler,
 and you log a message that has a newline in it, the log message is handled
 by the logger, but is silently discarded.

 For example if you sent the following:
 {{{
 logger.error('This is a\n test message')
 }}}

 The log message will be correctly written to any text-based log handlers
 or console log handlers, but the AdminEmailHandler silently fails.

 This is because the subject of an email can't contain newlines.

 Given that the AdminEmailHandler is intended as a mechanism for reporting
 serious errors, it's pretty bad that it can fail silently due to the
 contents of the message it's reporting. The "subject" of the log email
 should be cleansed of newlines before the call to mail_admins is made.

 This cleansing could also be performed in the mail utilities themselves.
 However, I'm not convinced this is the right place; the general mail tools
 have "fail_silently" as an option, so it would be possible to handle this
 error in a better way. Failing is not an option during logging, so we
 should make sure that the messages to be sent are appropriately cleansed.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17281>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to