
    lh                     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                   L    e Zd Z	 ddZd Zd Zd Zd Zd Zd Z	d	 Z
d
 Zd Zy)EventScrubberNc                    |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copydenylistDEFAULT_PII_DENYLISTlower	recursive)selfr2   r5   send_default_piipii_denylistxs         e/var/www/pru.catia.catastroantioquia-mas.com/tasa/lib/python3.12/site-packages/sentry_sdk/scrubber.py__init__zEventScrubber.__init__>   sp     4<3C(--//;/C$))+  MM\)M,0MM:q:" ;s   Bc                 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)r6   lstvs      r:   r@   zEventScrubber.scrub_listU   s8     #t$ 	AOOAOOA	    c                 <   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strr4   r2   r   +substituted_because_contains_sensitive_datar5   r?   r@   )r6   dkrB   s       r:   r?   zEventScrubber.scrub_dictd   sx     !T"GGI 	#DAq !S!aggi4==&@%QQS!""	#rC   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   r?   r6   events     r:   scrub_requestzEventScrubber.scrub_requestx   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extrarP   rQ   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userrP   rQ   s     r:   
scrub_userzEventScrubber.scrub_user   s4    (* 	/f.	/ 	/ 	/rW   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valuesrO   )r   r=   r   r?   )r6   rR   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   r?   )r6   rR   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spansrO   )r   r   r   r	   rG   objectr?   )r6   rR   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)rS   rV   rZ   r_   rc   rh   rQ   s     r:   scrub_eventzEventScrubber.scrub_event   sT    5!u%% rC   )NFFN)__name__
__module____qualname__r;   r@   r?   rS   rV   rZ   r_   rc   rh   rj    rC   r:   r.   r.   =   s7    SW#.#(	>0/
;36 rC   r.   N)sentry_sdk.utilsr   r   r   typingr   r   r   r	   sentry_sdk._typesr
   r   r0   r3   r.   rn   rC   r:   <module>rr      s=     3 2'% N t  t rC   