Add another test for security notification filtering
This commit is contained in:
parent
d036ff6d0d
commit
6a4584b87a
2 changed files with 23 additions and 7 deletions
|
@ -122,10 +122,14 @@ class VulnerabilityFoundEvent(NotificationEvent):
|
|||
|
||||
def should_perform(self, event_data, notification_data):
|
||||
event_config = json.loads(notification_data.event_config_json)
|
||||
expected_level_index = event_config['level']
|
||||
priority = PRIORITY_LEVELS[event_data['vulnerability']['priority']]
|
||||
actual_level_index = priority['index']
|
||||
return actual_level_index <= expected_level_index
|
||||
filter_level_index = int(event_config['level'])
|
||||
|
||||
event_severity = PRIORITY_LEVELS.get(event_data['vulnerability']['priority'])
|
||||
if event_severity is None:
|
||||
return False
|
||||
|
||||
actual_level_index = int(event_severity['index'])
|
||||
return actual_level_index <= filter_level_index
|
||||
|
||||
def get_summary(self, event_data, notification_data):
|
||||
msg = '%s vulnerability detected in repository %s in tags %s'
|
||||
|
|
Reference in a new issue