fix: hide redundant RDP workstation line when it matches server host
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -49,6 +49,64 @@ def test_rdp_failed_template_includes_user_ip_logon():
|
||||
assert "<b>" in text
|
||||
|
||||
|
||||
def test_rdp_login_hides_redundant_workstation_when_matches_hostname():
|
||||
host = Host(
|
||||
hostname="ITIS198",
|
||||
display_name="ITIS (192.168.160.198)",
|
||||
os_family="windows",
|
||||
)
|
||||
event = Event(
|
||||
event_id="00000000-0000-4000-8000-000000000508",
|
||||
host_id=1,
|
||||
host=host,
|
||||
occurred_at=datetime(2026, 5, 31, 18, 48, 52, tzinfo=timezone.utc),
|
||||
category="auth",
|
||||
type="rdp.login.success",
|
||||
severity="info",
|
||||
title="RDP login",
|
||||
summary="papatramp",
|
||||
details={
|
||||
"user": "papatramp",
|
||||
"ip_address": "192.168.160.3",
|
||||
"logon_type": 10,
|
||||
"workstation_name": "ITIS198",
|
||||
"event_id_windows": 4624,
|
||||
},
|
||||
payload={},
|
||||
)
|
||||
text = format_rdp_login_html(event)
|
||||
assert "ITIS" in text
|
||||
assert "192.168.160.3" in text
|
||||
assert "Рабочая станция" not in text
|
||||
assert "ITIS198" not in text
|
||||
|
||||
|
||||
def test_rdp_login_shows_workstation_when_client_differs():
|
||||
host = Host(hostname="ITIS198", display_name="ITIS", os_family="windows")
|
||||
event = Event(
|
||||
event_id="00000000-0000-4000-8000-000000000509",
|
||||
host_id=1,
|
||||
host=host,
|
||||
occurred_at=datetime(2026, 5, 31, 18, 48, 52, tzinfo=timezone.utc),
|
||||
category="auth",
|
||||
type="rdp.login.success",
|
||||
severity="info",
|
||||
title="RDP login",
|
||||
summary="papatramp",
|
||||
details={
|
||||
"user": "papatramp",
|
||||
"ip_address": "192.168.160.3",
|
||||
"logon_type": 10,
|
||||
"workstation_name": "NEW-ADMIN-PC",
|
||||
"event_id_windows": 4624,
|
||||
},
|
||||
payload={},
|
||||
)
|
||||
text = format_rdp_login_html(event)
|
||||
assert "Рабочая станция" in text
|
||||
assert "NEW-ADMIN-PC" in text
|
||||
|
||||
|
||||
def test_rdp_success_template():
|
||||
event = Event(
|
||||
event_id="00000000-0000-4000-8000-000000000502",
|
||||
|
||||
Reference in New Issue
Block a user