
    `iA                     p    d dl mZmZmZ d dlmZmZmZmZ erd dl	m
Z
 d dlmZ g dZg dZ G d d      Zy	)
    )capture_internal_exceptionsAnnotatedValueiter_event_frames)TYPE_CHECKINGcastListDict)Event)Optional) passwordpasswdsecretapi_keyapikeyauthcredentials	mysql_pwd
privatekeyprivate_keytokensession	csrftoken	sessionidx_csrftokenx_forwarded_for
set_cookiecookieauthorization	x_api_keyaiohttp_sessionzconnect.sid
csrf_tokencsrf_csrf_csrf_token	PHPSESSID_sessionsymfonyuser_session_xsrfz
XSRF-TOKEN)r   	x_real_ip
ip_addressremote_addrc                       e Zd Z	 	 	 	 ddddededdddf
dZd	eddfd
ZdeddfdZddZddZ	ddZ
ddZddZddZddZy)EventScrubberNdenylistzOptional[List[str]]	recursivesend_default_piipii_denylistreturnc                    |t         j                         n|| _        |s-|t        j                         n|}| xj                  |z  c_        | j                  D cg c]  }|j	                          c}| _        || _        yc c}w )a
  
        A scrubber that goes through the event payload and removes sensitive data configured through denylists.

        :param denylist: A security denylist that is always scrubbed, defaults to DEFAULT_DENYLIST.
        :param recursive: Whether to scrub the event payload recursively, default False.
        :param send_default_pii: Whether pii is sending is on, pii fields are not scrubbed.
        :param pii_denylist: The denylist to use for scrubbing when pii is not sent, defaults to DEFAULT_PII_DENYLIST.
        N)DEFAULT_DENYLISTcopyr/   DEFAULT_PII_DENYLISTlowerr0   )selfr/   r0   r1   r2   xs         Q/opt/aeropuerto/back/api/venv/lib/python3.12/site-packages/sentry_sdk/scrubber.py__init__zEventScrubber.__init__>   sp     4<3C(--//;/C$))+  MM\)M,0MM:q:" ;s   Blstc                 x    t        |t              sy|D ]$  }| j                  |       | j                  |       & y)a*  
        If a list is passed to this method, the method recursively searches the list and any
        nested lists for any dictionaries. The method calls scrub_dict on all dictionaries
        it finds.
        If the parameter passed to this method is not a list, the method does nothing.
        N)
isinstancelist
scrub_dict
scrub_list)r9   r=   vs      r;   rB   zEventScrubber.scrub_listX   s8     #t$ 	AOOAOOA	    dc                 <   t        |t              sy|j                         D ]x  \  }}t        |t              r4|j	                         | j
                  v rt        j                         ||<   J| j                  sW| j                  |       | j                  |       z y)a[  
        If a dictionary is passed to this method, the method scrubs the dictionary of any
        sensitive data. The method calls itself recursively on any nested dictionaries (
        including dictionaries nested in lists) if self.recursive is True.
        This method does nothing if the parameter passed to it is not a dictionary.
        N)r?   dictitemsstrr8   r/   r   +substituted_because_contains_sensitive_datar0   rA   rB   )r9   rE   krC   s       r;   rA   zEventScrubber.scrub_dictf   sx     !T"GGI 	#DAq !S!aggi4==&@%QQS!""	#rD   c                     t               5  d|v rZd|d   v r| j                  |d   d          d|d   v r| j                  |d   d          d|d   v r| j                  |d   d          d d d        y # 1 sw Y   y xY w)Nrequestheaderscookiesdatar   rA   r9   events     r;   scrub_requestzEventScrubber.scrub_requesty   s    (* 	>E!i 00OOE)$4Y$?@i 00OOE)$4Y$?@U9--OOE)$4V$<=	> 	> 	>s   AA33A<c                 r    t               5  d|v r| j                  |d          d d d        y # 1 sw Y   y xY w)NextrarQ   rR   s     r;   scrub_extrazEventScrubber.scrub_extra   s5    (* 	0%g/	0 	0 	0   -6c                 r    t               5  d|v r| j                  |d          d d d        y # 1 sw Y   y xY w)NuserrQ   rR   s     r;   
scrub_userzEventScrubber.scrub_user   s4    (* 	/f.	/ 	/ 	/rX   c                     t               5  d|v r@t        |d   t              s-d|d   v r&|d   d   D ]  }d|v s| j                  |d           d d d        y # 1 sw Y   y xY w)NbreadcrumbsvaluesrP   )r   r?   r   rA   )r9   rS   values      r;   scrub_breadcrumbszEventScrubber.scrub_breadcrumbs   sq    (* 	;%"5#7H E-$88!&}!5h!? ;!U? OOE&M:;	; 	; 	;s   .AAA"c                     t               5  t        |      D ]  }d|v s| j                  |d           	 d d d        y # 1 sw Y   y xY w)Nvars)r   r   rA   )r9   rS   frames      r;   scrub_frameszEventScrubber.scrub_frames   sH    (* 	3*51 3U?OOE&M23	3 	3 	3s   ??Ac                     t               5  d|v rEt        t        t        t        t
        f      |d         D ]  }d|v s| j                  |d           d d d        y # 1 sw Y   y xY w)NspansrP   )r   r   r   r	   rI   objectrA   )r9   rS   spans      r;   scrub_spanszEventScrubber.scrub_spans   sd    (* 	6% d3;&7!8%.I 6D~V56	6 	6 	6s   3AAA'c                     | j                  |       | j                  |       | j                  |       | j                  |       | j	                  |       | j                  |       y )N)rT   rW   r[   r`   rd   ri   rR   s     r;   scrub_eventzEventScrubber.scrub_event   sT    5!u%% rD   )NFFN)rS   r
   r3   N)__name__
__module____qualname__boolr<   rg   rB   rA   rT   rW   r[   r`   rd   ri   rk    rD   r;   r.   r.   =   s     +/!&.2#'# # 	#
 ,# 
#4f  #F #t #&>0
/
	;36 rD   r.   N)sentry_sdk.utilsr   r   r   typingr   r   r   r	   sentry_sdk._typesr
   r   r5   r7   r.   rp   rD   r;   <module>rt      s=     3 2'% N n  n rD   