Skip to content

Commit 175d78b

Browse files
authored
Merge branch 'main' into avara1986/APPSEC-60046_remove_more_iast_files
2 parents 80ba87b + ea7ad6e commit 175d78b

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

datadog_lambda/tag_object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ def _should_try_string(obj):
6262

6363
def _redact_val(k, v):
6464
split_key = k.split(".").pop() or k
65-
if split_key in redactable_keys:
65+
if split_key.lower() in redactable_keys:
6666
return "redacted"
6767
return v

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ classifiers = [
2828
python = ">=3.8.0,<4"
2929
datadog = ">=0.51.0,<1.0.0"
3030
wrapt = "^1.11.2"
31-
ddtrace = ">=3.16.2,<4"
31+
ddtrace = ">=3.16.2,<3.19.0"
3232
ujson = ">=5.9.0"
3333
botocore = { version = "^1.34.0", optional = true }
3434
requests = { version ="^2.22.0", optional = true }

tests/test_tag_object.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,14 @@ def test_tag_object_max_depth_0(self):
7373
"vals": [{"thingOne": 1}, {"thingTwo": 2}],
7474
}
7575
spanMock = MagicMock()
76+
expected_value = str(payload)
7677

7778
tag_object(spanMock, "function.request", payload)
7879
spanMock.set_tag.assert_has_calls(
7980
[
8081
call(
8182
"function.request",
82-
"{'hello': 'world', 'level1': {'level2_dict': {'level3': 3}, 'level2_list': [None, True, 'nice', {'l3': 'v3'}], 'level2_bool': True, 'level2_int': 2}, 'vals': [{'thingOne': 1}, {'thingTwo': 2}]}",
83+
expected_value,
8384
),
8485
],
8586
True,
@@ -105,6 +106,18 @@ def test_redacted_tag_object(self):
105106
True,
106107
)
107108

109+
def test_redacted_tag_object_case_insensitive(self):
110+
payload = {
111+
"Authorization": "secret",
112+
"headers": {"X-AUTHORIZATION": "another"},
113+
}
114+
spanMock = MagicMock()
115+
tag_object(spanMock, "function.request", payload)
116+
spanMock.set_tag.assert_any_call("function.request.Authorization", "redacted")
117+
spanMock.set_tag.assert_any_call(
118+
"function.request.headers.X-AUTHORIZATION", "redacted"
119+
)
120+
108121
def test_json_tag_object(self):
109122
payload = {
110123
"token": "world",

0 commit comments

Comments
 (0)