Viewing File: /opt/hc_python/lib/python3.12/site-packages/sentry_sdk/__pycache__/scrubber.cpython-312.pyc
�
_�*j� � �p � d dl mZmZmZmZ d dlmZmZmZ erd dl m Z d dl
mZ g d�Zg d�Z
G d� d� Zy )
� )�
TYPE_CHECKING�Dict�List�cast)�AnnotatedValue�capture_internal_exceptions�iter_event_frames)�Optional)�Event)!�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�
authorizationzproxy-authorization� x_api_key�aiohttp_sessionzconnect.sid�
csrf_token�csrf�_csrf�_csrf_token� PHPSESSID�_session�symfony�user_session�_xsrfz
XSRF-TOKEN)r � x_real_ip�
ip_address�remote_addrc � � e Zd Z ddddededdddf
d�Zd eddfd
�Zdeddfd�Zdd
�Zdd�Z dd�Z
dd�Zdd�Zdd�Z
dd�Zy)�
EventScrubberN�denylistzOptional[List[str]]� recursive�send_default_pii�pii_denylist�returnc � � |�t j � n|| _ |s-|�t j � n|}| xj |z
c_ | j D �cg c] }|j � �� c}| _ || _ yc 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 �B/opt/hc_python/lib/python3.12/site-packages/sentry_sdk/scrubber.py�__init__zEventScrubber.__init__@ st � � 4<�3C�(�-�-�/���
��/;�/C�$�)�)�+��
�
�M�M�\�)�M�,0�M�M�:�M�q�����M�:��
�"���� ;s �B�lstc �x � t |t � sy|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 zEventScrubber.scrub_listZ s3 � � �#�t�$���A��O�O�A���O�O�A�� � �dc �< � t |t � sy|j � D ]x \ }}t |t � r4|j � | j
v rt
j � ||<