
    gh                     z    S SK JrJrJr  S SKJrJrJrJr  \(       a  S SK	J
r
  S SKJr  / SQr/ SQr " S S5      rg	)
    )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                   V    \ rS rSr SS jrS rS rS rS rS r	S	 r
S
 rS rS rSrg)EventScrubber=   Nc                    Uc  [         R                  5       OUU l        U(       d.  Uc  [        R                  5       OUnU =R                  U-  sl        U R                   Vs/ s H  oUR	                  5       PM     snU l        X l        gs  snf )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)selfr3   r6   send_default_piipii_denylistxs         V/home/kali/devsecops-assessor/venv/lib/python3.13/site-packages/sentry_sdk/scrubber.py__init__EventScrubber.__init__>   sp     4<3C(--//;/C$))+  MM\)M,0MM:MqM:" ;s   "B
c                     [        U[        5      (       d  gU H%  nU R                  U5        U R                  U5        M'     g)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)r7   lstvs      r;   rB   EventScrubber.scrub_listU   s6     #t$$AOOAOOA     c                 d   [        U[        5      (       d  gUR                  5        H  u  p#[        U[        5      (       a7  UR	                  5       U R
                  ;   a  [        R                  " 5       X'   MQ  U R                  (       d  Md  U R                  U5        U R                  U5        M     g)a3  
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strr5   r3   r   +substituted_because_contains_sensitive_datar6   rA   rB   )r7   dkrD   s       r;   rA   EventScrubber.scrub_dictd   sw     !T""GGIDA !S!!aggi4==&@%QQS"" rF   c                    [        5          SU;   a`  SUS   ;   a  U R                  US   S   5        SUS   ;   a  U R                  US   S   5        SUS   ;   a  U R                  US   S   5        S S S 5        g ! , (       d  f       g = f)Nrequestheaderscookiesdatar   rA   r7   events     r;   scrub_requestEventScrubber.scrub_requestx   s    (*E!i 00OOE)$4Y$?@i 00OOE)$4Y$?@U9--OOE)$4V$<= +**s   A'A;;
B	c                     [        5          SU;   a  U R                  US   5        S S S 5        g ! , (       d  f       g = f)NextrarT   rU   s     r;   scrub_extraEventScrubber.scrub_extra   s,    (*%g/ +**   /
=c                     [        5          SU;   a  U R                  US   5        S S S 5        g ! , (       d  f       g = f)NuserrT   rU   s     r;   
scrub_userEventScrubber.scrub_user   s+    (*f. +**r]   c                     [        5          SU;   aL  [        US   [        5      (       d4  SUS   ;   a+  US   S    H  nSU;   d  M  U R                  US   5        M!     S S S 5        g ! , (       d  f       g = f)NbreadcrumbsvaluesrS   )r   r?   r   rA   )r7   rV   values      r;   scrub_breadcrumbsEventScrubber.scrub_breadcrumbs   sg    (*%"5#7HH E-$88!&}!5h!?!U? OOE&M: "@ +**s   7A'A''
A5c                     [        5          [        U5       H  nSU;   d  M  U R                  US   5        M!     S S S 5        g ! , (       d  f       g = f)Nvars)r   r   rA   )r7   rV   frames      r;   scrub_framesEventScrubber.scrub_frames   s:    (**51U?OOE&M2 2 +**s   AA
Ac                     [        5          SU;   aJ  [        [        [        [        [
        4      US   5       H  nSU;   d  M  U R                  US   5        M!     S S S 5        g ! , (       d  f       g = f)NspansrS   )r   r   r   r	   rJ   objectrA   )r7   rV   spans      r;   scrub_spansEventScrubber.scrub_spans   sW    (*% d3;&7!8%.ID~V5 J +**s   5A%A%%
A3c                     U R                  U5        U R                  U5        U R                  U5        U R                  U5        U R	                  U5        U R                  U5        g )N)rW   r[   r`   rf   rk   rq   rU   s     r;   scrub_eventEventScrubber.scrub_event   sT    5!u%% rF   )r3   r6   )NFFN)__name__
__module____qualname____firstlineno__r<   rB   rA   rW   r[   r`   rf   rk   rq   rt   __static_attributes__ rF   r;   r.   r.   =   s7    SW#.#(	>0/
;36 rF   r.   N)sentry_sdk.utilsr   r   r   typingr   r   r   r	   sentry_sdk._typesr
   r   r1   r4   r.   r{   rF   r;   <module>r      s=     3 2'% N t  t rF   