Viewing File: /opt/hc_python/lib/python3.12/site-packages/sentry_sdk/__pycache__/scrubber.cpython-312.pyc

�

_�*j���p�ddlmZmZmZmZddlmZmZmZerddlm	Z	ddl
mZgd�Zgd�Z
Gd�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��eZdZ				ddddededdddf
d�Zd	eddfd
�Zdeddfd�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zy)�
EventScrubberN�denylistzOptional[List[str]]�	recursive�send_default_pii�pii_denylist�returnc��|�tj�n||_|s-|�tj�n|}|xj|z
c_|jD�cgc]}|j	���c}|_||_ycc}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/r0r1r2�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)r9r=�vs   r;rBzEventScrubber.scrub_listZs3���#�t�$���A��O�O�A���O�O�A����dc�<�t|t�sy|j�D]x\}}t|t�r4|j	�|j
vrt
j�||<�J|js�W|j|�|j|��zy)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�strr8r/r�+substituted_because_contains_sensitive_datar0rArB)r9rE�krCs    r;rAzEventScrubber.scrub_dicthss���!�T�"���G�G�I�D�A�q��!�S�!�a�g�g�i�4�=�=�&@�%�Q�Q�S��!���������"�����"�rDc��t�5d|vrZd|dvr|j|dd�d|dvr|j|dd�d|dvr|j|dd�ddd�y#1swYyxYw)N�request�headers�cookies�data�rrA�r9�events  r;�
scrub_requestzEventScrubber.scrub_request{s���
(�
*��E�!���i� 0�0��O�O�E�)�$4�Y�$?�@���i� 0�0��O�O�E�)�$4�Y�$?�@��U�9�-�-��O�O�E�)�$4�V�$<�=�+�
*�
*�s�AA3�3A<c�r�t�5d|vr|j|d�ddd�y#1swYyxYw)N�extrarQrRs  r;�scrub_extrazEventScrubber.scrub_extra�s,��
(�
*��%������g��/�+�
*�
*�s�-�6c���t�5d|vrF|d}d|jvr"t|t�r|j	dd�|j|�ddd�y#1swYyxYw)N�userr+)rr/r?rG�poprA)r9rSrYs   r;�
scrub_userzEventScrubber.scrub_user�sS��
(�
*�����V�}���4�=�=�0�Z��d�5K��H�H�\�4�0�����%�+�
*�
*�s�AA�A(c���t�5d|vr@t|dt�s-d|dvr&|ddD]}d|vs�|j|d��ddd�y#1swYyxYw)N�breadcrumbs�valuesrP)rr?rrA)r9rS�values   r;�scrub_breadcrumbszEventScrubber.scrub_breadcrumbs�sd��
(�
*���%�"�5��#7��H� �E�-�$8�8�!&�}�!5�h�!?��!�U�?� �O�O�E�&�M�:�"@�
+�
*�
*�s�.A�A�A"c��t�5t|�D]}d|vs�|j|d��	ddd�y#1swYyxYw)N�vars)rr	rA)r9rS�frames   r;�scrub_frameszEventScrubber.scrub_frames�s:��
(�
*�*�5�1���U�?��O�O�E�&�M�2�2�+�
*�
*�s
�?�?�Ac���t�5d|vrEttttt
f|d�D]}d|vs�|j
|d��ddd�y#1swYyxYw)N�spansrP)rrrrrI�objectrA)r9rS�spans   r;�scrub_spanszEventScrubber.scrub_spans�sW��
(�
*��%�� ��d�3��;�&7�!8�%��.�I�D���~�����V��5�J�+�
*�
*�s�3A�A�A'c���|j|�|j|�|j|�|j|�|j	|�|j|�y)N)rTrWr[r`rdrirRs  r;�scrub_eventzEventScrubber.scrub_event�sT�����5�!��������������u�%����%� �����rD)NFFN)rSrr3N)�__name__�
__module__�__qualname__�boolr<rgrBrArTrWr[r`rdrirk�rDr;r.r.?s���+/��!&�.2�#�'�#��#��	#�
,�#�
�
#�4�f����#�F�#�t�#�&>�0�
&�	;�3�6� rDr.N)�typingrrrr�sentry_sdk.utilsrrr	r
�sentry_sdk._typesrr5r7r.rprDr;�<module>rts=��2�2�����'�&��P��q �q rD
Back to Directory File Manager