From ed9d8fdec934b4057993246ab57555986e7b828c Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Wed, 22 Jan 2025 13:29:26 -0500 Subject: [PATCH] fix constant --- ddtrace/appsec/_iast/_taint_utils.py | 4 ++-- ddtrace/constants.py | 3 ++- ddtrace/internal/utils/http.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ddtrace/appsec/_iast/_taint_utils.py b/ddtrace/appsec/_iast/_taint_utils.py index 23508be2ca6..524e8279d2b 100644 --- a/ddtrace/appsec/_iast/_taint_utils.py +++ b/ddtrace/appsec/_iast/_taint_utils.py @@ -335,7 +335,7 @@ def __init__(self, original_dict, origins=(0, 0), override_pyobject_tainted=Fals self._obj = original_dict self._origins = origins - self.ORIGIN_KEY = origins[0] if origins[0] else OriginType.PARAMETER_NAME + self._origin_key = origins[0] if origins[0] else OriginType.PARAMETER_NAME self._origin_value = origins[1] if origins[1] else OriginType.PARAMETER self._override_pyobject_tainted = override_pyobject_tainted @@ -471,7 +471,7 @@ def items(self): def keys(self): for k in self._obj.keys(): - yield self._taint(k, k, self.ORIGIN_KEY) + yield self._taint(k, k, self._origin_key) def pop(self, *args): return self._taint(self._obj.pop(*args), "pop") diff --git a/ddtrace/constants.py b/ddtrace/constants.py index 78d4499c44e..7cbbc6c3a1d 100644 --- a/ddtrace/constants.py +++ b/ddtrace/constants.py @@ -62,7 +62,8 @@ "SAMPLING_AGENT_DECISION", "SAMPLING_RULE_DECISION", "SAMPLING_LIMIT_DECISION", - "ORIGIN_KEY" "USER_ID_KEY", + "ORIGIN_KEY", + "USER_ID_KEY", "HOSTNAME_KEY", "RUNTIME_FAMILY", "BASE_SERVICE_KEY", diff --git a/ddtrace/internal/utils/http.py b/ddtrace/internal/utils/http.py index 77b85de47a3..f9c13827d3d 100644 --- a/ddtrace/internal/utils/http.py +++ b/ddtrace/internal/utils/http.py @@ -24,9 +24,9 @@ from ddtrace.internal.constants import BLOCKED_RESPONSE_JSON from ddtrace.internal.constants import DEFAULT_TIMEOUT from ddtrace.internal.constants import SAMPLING_DECISION_TRACE_TAG_KEY +from ddtrace.internal.constants import W3C_TRACESTATE_ORIGIN_KEY from ddtrace.internal.constants import W3C_TRACESTATE_PARENT_ID_KEY from ddtrace.internal.constants import W3C_TRACESTATE_SAMPLING_PRIORITY_KEY -from ddtrace.internal.constants import W3C_TRACESTATEORIGIN_KEY from ddtrace.internal.http import HTTPConnection from ddtrace.internal.http import HTTPSConnection from ddtrace.internal.uds import UDSHTTPConnection @@ -153,7 +153,7 @@ def w3c_get_dd_list_member(context): if context.dd_origin: tags.append( "{}:{}".format( - W3C_TRACESTATEORIGIN_KEY, + W3C_TRACESTATE_ORIGIN_KEY, w3c_encode_tag((_W3C_TRACESTATE_INVALID_CHARS_REGEX_VALUE, "_", context.dd_origin)), ) )