feat(schema): add Alert -> enodia.event.v1 reference wrapper
This commit is contained in:
parent
54bd8ff1f4
commit
65f5be6420
3 changed files with 22 additions and 0 deletions
|
|
@ -42,6 +42,20 @@ class TestEventEnvelope(unittest.TestCase):
|
|||
def test_event_types_is_closed_set(self):
|
||||
self.assertEqual(event.EVENT_TYPES, frozenset({"alert", "incident", "status"}))
|
||||
|
||||
def test_from_alert_wraps_alert_payload(self):
|
||||
from enodia_sentinel.alert import Alert, Severity
|
||||
alert = Alert(
|
||||
Severity.CRITICAL, "reverse_shell", "rsh:4242",
|
||||
"pid=4242 peer=[8.8.8.8:4444]", (4242,),
|
||||
sid=100010, classtype="command-and-control")
|
||||
env = event.from_alert(alert, host="host-a")
|
||||
self.assertEqual(env["event_type"], "alert")
|
||||
self.assertEqual(env["host"], "host-a")
|
||||
# Payload is the untouched enodia.alert.v1 object.
|
||||
self.assertEqual(env["alert"], alert.to_dict())
|
||||
self.assertEqual(env["alert"]["signature"], "reverse_shell")
|
||||
self.assertEqual(env["alert"]["sid"], 100010)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue