Skip to content

Commit 75429dc

Browse files
committed
no annotatedvalues
1 parent babb3bd commit 75429dc

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

sentry_sdk/integrations/_asgi_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _get_request_attributes(asgi_scope: "Any") -> "dict[str, Any]":
119119
if asgi_scope.get("method"):
120120
attributes["http.request.method"] = asgi_scope["method"].upper()
121121

122-
headers = _filter_headers(_get_headers(asgi_scope))
122+
headers = _filter_headers(_get_headers(asgi_scope), use_annotated_value=False)
123123
for header, value in headers.items():
124124
attributes[f"http.request.header.{header.lower()}"] = value
125125

sentry_sdk/integrations/_wsgi_common.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from copy import deepcopy
44

55
import sentry_sdk
6+
from sentry_sdk._types import SENSITIVE_DATA_SUBSTITUTE
67
from sentry_sdk.scope import should_send_default_pii
78
from sentry_sdk.utils import AnnotatedValue, logger
89

@@ -211,16 +212,18 @@ def _is_json_content_type(ct: "Optional[str]") -> bool:
211212

212213
def _filter_headers(
213214
headers: "Mapping[str, str]",
215+
use_annotated_value: bool = True,
214216
) -> "Mapping[str, Union[AnnotatedValue, str]]":
215217
if should_send_default_pii():
216218
return headers
217219

220+
if use_annotated_value:
221+
substitute = AnnotatedValue.removed_because_over_size_limit()
222+
else:
223+
substitute = SENSITIVE_DATA_SUBSTITUTE
224+
218225
return {
219-
k: (
220-
v
221-
if k.upper().replace("-", "_") not in SENSITIVE_HEADERS
222-
else AnnotatedValue.removed_because_over_size_limit()
223-
)
226+
k: (v if k.upper().replace("-", "_") not in SENSITIVE_HEADERS else substitute)
224227
for k, v in headers.items()
225228
}
226229

0 commit comments

Comments
 (0)