Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions limacharlie/sdk/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ def create_case(
"""
data: dict[str, Any] = {}
if detection is not None:
# The extension schema declares detection as type "json",
# which the platform validates as a JSON string (not a dict).
data["detection"] = json.dumps(detection)
# Pass the detection dict directly — the gzdata encoding
# already JSON-serializes the full data dict, so json.dumps
# here would double-encode it into a string that the LC
# backend drops (schema type "json" expects an object).
data["detection"] = detection
if severity is not None:
data["severity"] = severity
if summary is not None:
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_sdk_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_calls_extension_request(self, cases, mock_org):
MockExt.assert_called_once_with(mock_org)
mock_ext.request.assert_called_once_with(
"ext-cases", "create_case",
data={"detection": json.dumps(self._SAMPLE_DETECTION)},
data={"detection": self._SAMPLE_DETECTION},
)
assert result["case_id"] == "tid-new"

Expand All @@ -100,7 +100,7 @@ def test_all_optional_fields(self, cases, mock_org):
)
call_data = mock_ext.request.call_args[1]["data"]
assert call_data == {
"detection": json.dumps(self._SAMPLE_DETECTION),
"detection": self._SAMPLE_DETECTION,
"severity": "high",
"summary": "Test summary",
}
Expand Down Expand Up @@ -144,7 +144,7 @@ def test_with_summary(self, cases, mock_org):
)
call_data = mock_ext.request.call_args[1]["data"]
assert call_data == {
"detection": json.dumps(self._SAMPLE_DETECTION),
"detection": self._SAMPLE_DETECTION,
"severity": "high",
"summary": "Lateral movement detected",
}
Expand Down