a
    Lcòf  ã                   @   sŽ   d dl Z d dlmZ ddlmZmZmZmZ eddd�Zedd	d�Z	d
d„ Z
eejdd�dd„ ƒZeejdd�dd„ ƒZeejƒdd„ ƒZdS )é    N)Úsettingsé   )ÚErrorÚTagsÚWarningÚregistera  You don't appear to be using Django's built-in cross-site request forgery protection via the middleware ('django.middleware.csrf.CsrfViewMiddleware' is not in your MIDDLEWARE). Enabling the middleware is the safest approach to ensure you don't leave any holes.zsecurity.W003©ÚidzçYou have 'django.middleware.csrf.CsrfViewMiddleware' in your MIDDLEWARE, but you have not set CSRF_COOKIE_SECURE to True. Using a secure-only CSRF cookie makes it more difficult for network traffic sniffers to steal the CSRF token.zsecurity.W016c                   C   s
   dt jv S )Nz)django.middleware.csrf.CsrfViewMiddleware)r   Z
MIDDLEWARE© r
   r
   ú]/home/httpd/docs/test/DocsMgr/lib/python3.9/site-packages/django/core/checks/security/csrf.pyÚ_csrf_middleware   s    r   T)Zdeployc                 K   s   t ƒ }|rg S tgS )N)r   ÚW003©Úapp_configsÚkwargsZpassed_checkr
   r
   r   Úcheck_csrf_middleware   s    r   c                 K   s&   t jptƒ  pt jdu }|r g S tgS )NT)r   ZCSRF_USE_SESSIONSr   ZCSRF_COOKIE_SECUREÚW016r   r
   r
   r   Úcheck_csrf_cookie_secure#   s    ÿýr   c              	   K   s–   ddl m} g }z
|ƒ }W n. tyH   dtj }| t|dd�¡ Y nJ0 zt |¡j	d d d� W n. t
y�   dtj }| t|dd�¡ Y n0 |S )	Nr   )Ú_get_failure_viewz1The CSRF failure view '%s' could not be imported.zsecurity.E102r   )ÚreasonzIThe CSRF failure view '%s' does not take the correct number of arguments.zsecurity.E101)Zdjango.middleware.csrfr   ÚImportErrorr   ZCSRF_FAILURE_VIEWÚappendr   ÚinspectÚ	signatureÚbindÚ	TypeError)r   r   r   ÚerrorsÚviewÚmsgr
   r
   r   Úcheck_csrf_failure_view-   s&    
ÿÿÿÿr   )r   Zdjango.confr   Ú r   r   r   r   r   r   r   Úsecurityr   r   r   r
   r
   r
   r   Ú<module>   s"   ú	û	

	