Skip to content
Closed
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
18 changes: 18 additions & 0 deletions tests/unit/endpoints/test_records_endpoint_security.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Security tests for RecordsEndpoint."""

import pytest

from imednet.endpoints.records import RecordsEndpoint


def test_create_email_notify_header_injection(dummy_client, context):
"""Test that header injection via email_notify raises ValueError."""
ep = RecordsEndpoint(dummy_client, context)

# Test with newline
with pytest.raises(ValueError, match="email_notify must not contain newlines"):
ep.create("S1", [{"foo": "bar"}], email_notify="test@example.com\nBcc: evil@example.com")

# Test with carriage return
with pytest.raises(ValueError, match="email_notify must not contain newlines"):
ep.create("S1", [{"foo": "bar"}], email_notify="test@example.com\rBcc: evil@example.com")