django AdminEmailHandler send sensitive information when include_html is False

37 Views Asked by At

i use django.utils.log.AdminEmailHandler for my logging handler class. In Django docs, title was said as a security note to turn False include_html for not sending sensitive information.

This is my Logging Config:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters':{
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        },
    },
    'handlers': {
        'django_mail_logger': {                                   
            'level': 'ERROR',                                     
            'filters': ['require_debug_false'],                   
            'class': 'django.utils.log.AdminEmailHandler', 
            'include_html': False,                           
        },  
    },                                                          
    'loggers': {                                                  
        'django': {                                               
            'handlers': ['django_mail_logger'],
            'level': 'INFO',                                  
        },                                                        
    },                                                          
}

As the note was mentioned in docs , I set False the include_html to not send traceback and etc, but when an error occurs, my Django app sends traceback, settings, and etc., as when debug is false and only doesn't use HTML. is Django docs correct or did I misconfigure handler?

I use Django 4.2 and Python 3.8.

I try the logging configuration, which I mentioned, and I expect to email me less information, but I receive sensitive information.

0

There are 0 best solutions below