
    tniA                     x    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d	S )
    )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dS )EventScrubberNFdenylistzOptional[List[str]]	recursivesend_default_piipii_denylistreturnc                     |t                                           n|| _        |s-|t                                          n|}| xj        |z  c_        d | j        D             | _        || _        dS )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.
        Nc                 6    g | ]}|                                 S  )lower).0xs     P/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/sentry_sdk/scrubber.py
<listcomp>z*EventScrubber.__init__.<locals>.<listcomp>U   s     :::q:::    )DEFAULT_DENYLISTcopyr/   DEFAULT_PII_DENYLISTr0   )selfr/   r0   r1   r2   s        r:   __init__zEventScrubber.__init__>   s}     4<3C(--/// 	*/;/C$))+++  MM\)MM::DM:::"r<   lstc                     t          |t                    sdS |D ],}|                     |           |                     |           -dS )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)r@   rB   vs      r:   rG   zEventScrubber.scrub_listX   s[     #t$$ 	F 	 	AOOAOOA	 	r<   dc                 X   t          |t                    sdS |                                D ]}\  }}t          |t                    r2|                                | j        v rt          j                    ||<   L| j        r*| 	                    |           | 
                    |           ~dS )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)rD   dictitemsstrr7   r/   r   +substituted_because_contains_sensitive_datar0   rF   rG   )r@   rI   krH   s       r:   rF   zEventScrubber.scrub_dictf   s     !T"" 	FGGII 	# 	#DAq !S!! #aggii4=&@&@%QSS! #""""""	# 	#r<   eventr
   c                 ^   t                      5  d|v rd|d         v r!|                     |d         d                    d|d         v r!|                     |d         d                    d|d         v r!|                     |d         d                    d d d            d S # 1 swxY w Y   d S )Nrequestheaderscookiesdatar   rF   r@   rP   s     r:   scrub_requestzEventScrubber.scrub_requesty   s   (** 	> 	>E!!i 000OOE)$4Y$?@@@i 000OOE)$4Y$?@@@U9---OOE)$4V$<===	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>s   BB""B&)B&c                     t                      5  d|v r|                     |d                    d d d            d S # 1 swxY w Y   d S )NextrarV   rW   s     r:   scrub_extrazEventScrubber.scrub_extra   s    (** 	0 	0%g///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0    <A A c                     t                      5  d|v r|                     |d                    d d d            d S # 1 swxY w Y   d S )NuserrV   rW   s     r:   
scrub_userzEventScrubber.scrub_user   s    (** 	/ 	/f...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/r\   c                    t                      5  d|v rUt          |d         t                    s:d|d         v r0|d         d         D ]!}d|v r|                     |d                    "d d d            d S # 1 swxY w Y   d S )NbreadcrumbsvaluesrU   )r   rD   r   rF   )r@   rP   values      r:   scrub_breadcrumbszEventScrubber.scrub_breadcrumbs   s    (** 	; 	;%%"5#7HH; E-$888!&}!5h!? ; ;!U?? OOE&M:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;s   AA66A:=A:c                     t                      5  t          |          D ]!}d|v r|                     |d                    "	 d d d            d S # 1 swxY w Y   d S )Nvars)r   r   rF   )r@   rP   frames      r:   scrub_frameszEventScrubber.scrub_frames   s    (** 	3 	3*511 3 3U??OOE&M2223	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3s   2AAAc                    t                      5  d|v rZt          t          t          t          t
          f                  |d                   D ]!}d|v r|                     |d                    "d d d            d S # 1 swxY w Y   d S )NspansrU   )r   r   r   r	   rM   objectrF   )r@   rP   spans      r:   scrub_spanszEventScrubber.scrub_spans   s    (** 	6 	6% d3;&7!8%.II 6 6D~~V555		6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6s   AA;;A?A?c                    |                      |           |                     |           |                     |           |                     |           |                     |           |                     |           d S )N)rX   r[   r_   rd   rh   rm   rW   s     r:   scrub_eventzEventScrubber.scrub_event   s~    5!!!u%%%%   r<   )NFFN)rP   r
   r3   N)__name__
__module____qualname__boolrA   rk   rG   rF   rX   r[   r_   rd   rh   rm   ro   r6   r<   r:   r.   r.   =   s;        +/!&.2# #'# # 	#
 ,# 
# # # #4f     #F #t # # # #&> > > >0 0 0 0
/ / / /
	; 	; 	; 	;3 3 3 36 6 6 6           r<   r.   N)sentry_sdk.utilsr   r   r   typingr   r   r   r	   sentry_sdk._typesr
   r   r=   r?   r.   r6   r<   r:   <module>rw      s             3 2 2 2 2 2 2 2 2 2 2 2  ''''''% % % N   n  n  n  n  n  n  n  n  n  n r<   