o
    i                     @   s~   d dl mZ d dl mZ d dlmZ d dlmZ d dlmZ er&d dl	m
Z
 G dd dZd	ee fd
dZd	efddZdS )    )TYPE_CHECKING)Optional)Span)IAST)core)IastSpanReporterc                   @   s6   e Zd ZdZd	dee fddZedefddZ	dS )
IASTEnvironmentz
    an object of this class contains all iast data
    for a single request. It is bound to a single iast request context.
    It is contained into a ContextVar.
    Nspanc                 C   sN   |pt  | _d | _i | _i | _d| _i | _i | _d| _	d| _
d| _d| _d S )NFr   T )r   get_spanr	   iast_reporteriast_span_metricsiast_hash_object_trackingiast_stack_trace_reportedvulnerability_copy_global_limitvulnerabilities_request_limitvulnerability_budgetis_first_vulnerabilityendpoint_methodendpoint_route)selfr	    r   R/home/ubuntu/.local/lib/python3.10/site-packages/ddtrace/appsec/_iast/_iast_env.py__init__   s   
zIASTEnvironment.__init__returnc                 C   s   | j  d| j S )a  
        Create a unique key for an endpoint based on HTTP method and route.

        Args:
            method (str): HTTP method (GET, POST, etc.)
            route (str): HTTP route/endpoint path

        Returns:
            str: Combined key as "METHOD:ROUTE"
        :)r   r   )r   r   r   r   endpoint_key"   s   zIASTEnvironment.endpoint_keyN)
__name__
__module____qualname____doc__r   r   r   propertystrr   r   r   r   r   r      s
    r   r   c                   C   s   t tjS r   r   	find_itemr   REQUEST_CONTEXT_KEYr   r   r   r   _get_iast_env1   s   r'   c                   C   s   t tjd uS r   r$   r   r   r   r   in_iast_env5   s   r(   N)typingr   r   ddtrace._trace.spanr   ddtrace.appsec._constantsr   ddtrace.internalr   ddtrace.appsec._iast.reporterr   r   r'   boolr(   r   r   r   r   <module>   s    $