@@ -557,15 +557,7 @@ def get_risk_events(self, force_update: bool = False) -> list[RiskEvent]:
557557 return self ._risk_events
558558
559559 # Search for all risk events from a single search (indicated by orig_sid)
560- if self .sid is None :
561- # query for validating detection is starting from a disabled state
562- query = (
563- f'search index=risk search_name="{ self .name } " [search index=risk search '
564- f'search_name="{ self .name } " | tail 1 | fields orig_sid] | tojson'
565- )
566- else :
567- # query after the detection has been enabled and dispatched
568- query = f'search index=risk search_name="{ self .name } " orig_sid="{ self .sid } " | tojson'
560+ query = f'search index=risk search_name="{ self .name } " orig_sid="{ self .sid } " | tojson'
569561 result_iterator = self ._search (query )
570562
571563 # Iterate over the events, storing them in a list and checking for any errors
@@ -638,15 +630,7 @@ def get_notable_events(self, force_update: bool = False) -> list[NotableEvent]:
638630 return self ._notable_events
639631
640632 # Search for all notable events from a single search (indicated by orig_sid)
641- if self .sid is None :
642- # query for validating detection is starting from a disabled state
643- query = (
644- f'search index=notable search_name="{ self .name } " [search index=notable search '
645- f'search_name="{ self .name } " | tail 1 | fields orig_sid] | tojson'
646- )
647- else :
648- # query after the detection has been enabled and dispatched
649- query = f'search index=notable search_name="{ self .name } " orig_sid="{ self .sid } " | tojson'
633+ query = f'search index=notable search_name="{ self .name } " orig_sid="{ self .sid } " | tojson'
650634 result_iterator = self ._search (query )
651635
652636 # Iterate over the events, storing them in a list and checking for any errors
@@ -722,18 +706,10 @@ def get_risk_dm_events(self, force_update: bool = False) -> list[BaseSecurityEve
722706
723707 # Search for all risk data model events from a single search (indicated by
724708 # orig_sid)
725- if self .sid is None :
726- # query for validating detection is starting from a disabled state
727- query = (
728- f'datamodel Risk All_Risk flat | search search_name="{ self .name } " '
729- f'[search datamodel Risk All_Risk flat | search search_name="{ self .name } " '
730- "| tail 1 | fields orig_sid] | tojson"
731- )
732- else :
733- query = (
734- f'datamodel Risk All_Risk flat | search search_name="{ self .name } " orig_sid="{ self .sid } " '
735- "| tojson"
736- )
709+ query = (
710+ f'datamodel Risk All_Risk flat | search search_name="{ self .name } " orig_sid="{ self .sid } " '
711+ "| tojson"
712+ )
737713 result_iterator = self ._search (query )
738714
739715 # Iterate over the events, storing them in a list and checking for any errors
@@ -1044,19 +1020,6 @@ def test(
10441020 elapsed_sleep_time = {"elapsed_sleep_time" : 0 }
10451021
10461022 try :
1047- # first make sure the indexes are currently empty and the detection is starting from a disabled state
1048- self .logger .debug ("Cleaning up any pre-existing risk/notable events..." )
1049- self .update_pbar (TestingStates .PRE_CLEANUP )
1050- if self .risk_event_exists ():
1051- self .logger .warning (
1052- f"Risk events matching '{ self .name } ' already exist; marking for deletion"
1053- )
1054- if self .notable_event_exists ():
1055- self .logger .warning (
1056- f"Notable events matching '{ self .name } ' already exist; marking for deletion"
1057- )
1058- self .cleanup ()
1059-
10601023 # skip test if no risk or notable action defined
10611024 if not self .has_risk_analysis_action and not self .has_notable_action :
10621025 message = (
0 commit comments