Your IP : 18.117.232.108


Current Path : /opt/alt/python37/lib/python3.7/site-packages/raven/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/raven/__pycache__/processors.cpython-37.pyc

B

��Y��@sxdZddlmZddlZddlmZmZddlmZGdd�de	�Z
Gdd	�d	e
�ZGd
d�de
�ZGdd
�d
e
�Z
dS)z�
raven.core.processors
~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
�)�absolute_importN)�string_types�	text_type)�varmapc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�	ProcessorcCs
||_dS)N)�client)�selfr�r	�A/opt/alt/python37/lib/python3.7/site-packages/raven/processors.py�__init__szProcessor.__init__cKsdS)Nr	)r�data�kwargsr	r	r
�get_dataszProcessor.get_datacKs�|j|f|�}|r|}d|krZd|dkrZx.|d�dg�D]}d|kr<|�|d�q<Wd|krp|�|d�d|kr�|�|d�|d<|S)N�	exception�valuesZ
stacktraceZrequest�extra)r�get�filter_stacktrace�filter_http�filter_extra)rrr
Zresp�valuer	r	r
�processszProcessor.processcCsdS)Nr	)rrr	r	r
r*szProcessor.filter_stacktracecCsdS)Nr	)rrr	r	r
r-szProcessor.filter_httpcCs|S)Nr	)rrr	r	r
r0szProcessor.filter_extraN)	�__name__�
__module__�__qualname__rrrrrrr	r	r	r
rsrc@seZdZdZdd�ZdS)�RemovePostDataProcessorzRemoves HTTP post data.cKs|�dd�dS)Nr)�pop)rrr
r	r	r
r7sz#RemovePostDataProcessor.filter_httpN)rrr�__doc__rr	r	r	r
r4src@seZdZdZdd�ZdS)�RemoveStackLocalsProcessorz1Removes local context variables from stacktraces.cKs&x |�dg�D]}|�dd�qWdS)N�frames�vars)rr)rrr
�framer	r	r
r>sz,RemoveStackLocalsProcessor.filter_stacktraceN)rrrrrr	r	r	r
r;src	@s^eZdZdZdZeddddddd	d
g�Ze�d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�ZdS)�SanitizePasswordsProcessorz�
    Asterisk out things that look like passwords, credit card numbers,
    and API keys in frames, http, and basic extra data.
    z********�passwordZsecret�passwdZ
authorizationZapi_keyZapikeyZ
sentry_dsnZaccess_tokenz^(?:\d[ -]*?){13,16}$cCsz|dkrdSt|t�r(|j�|�r(|jS|s0|St|t�rH|�dd�}nt|�}|��}x|j	D]}||kr`|jSq`W|S)Nzutf-8�replace)
�
isinstancer�	VALUES_RE�match�MASK�bytes�decoder�lower�FIELDS)r�keyr�fieldr	r	r
�sanitizeVs

z#SanitizePasswordsProcessor.sanitizecCs8x2|�dg�D]"}d|krqt|j|d�|d<qWdS)Nrr )rrr0)rrr!r	r	r
rnsz,SanitizePasswordsProcessor.filter_stacktracecCs�x�dD]�}||krqt||t�rVd||krV|dkr<d}nd}|�|||�||<qt|j||�||<|dkrd||kr|�||dd�||d<qWdS)N)r�cookies�headers�envZquery_string�=r1�;�&r2�Cookie)r&r�_sanitize_keyvalsrr0)rr�n�	delimiterr	r	r
rts
z&SanitizePasswordsProcessor.filter_httpcCst|j|�S)N)rr0)rrr	r	r
r�sz'SanitizePasswordsProcessor.filter_extracCsfg}xL|�|�D]>}|�d�}t|�dkrD|�|d|j|�f�q|�|�qW|�dd�|D��S)Nr4�rcss|]}d�|�VqdS)r4N)�join)�.0�keyvalr	r	r
�	<genexpr>�sz?SanitizePasswordsProcessor._sanitize_keyvals.<locals>.<genexpr>)�split�len�appendr0r<)rZkeyvalsr:Zsanitized_keyvalsr>r	r	r
r8�s
z,SanitizePasswordsProcessor._sanitize_keyvalsN)rrrrr)�	frozensetr-�re�compiler'r0rrrr8r	r	r	r
r"Cs"
r")r�
__future__rrDZraven.utils.compatrrZraven.utilsr�objectrrrr"r	r	r	r
�<module>s$

?>