Batch QSS notifications after initial scan
This commit is contained in:
parent
c54a99b2c2
commit
eff1827d9d
3 changed files with 60 additions and 21 deletions
|
@ -113,13 +113,14 @@ def _build_summary(event_data):
|
|||
class VulnerabilityFoundEvent(NotificationEvent):
|
||||
CONFIG_LEVEL = 'level'
|
||||
VULNERABILITY_KEY = 'vulnerability'
|
||||
MULTIPLE_VULNERABILITY_KEY = 'vulnerabilities'
|
||||
|
||||
@classmethod
|
||||
def event_name(cls):
|
||||
return 'vulnerability_found'
|
||||
|
||||
def get_level(self, event_data, notification_data):
|
||||
priority = event_data['vulnerability']['priority']
|
||||
priority = event_data[VulnerabilityFoundEvent.CONFIG_LEVEL]['priority']
|
||||
if priority == 'Defcon1' or priority == 'Critical':
|
||||
return 'error'
|
||||
|
||||
|
@ -166,9 +167,14 @@ class VulnerabilityFoundEvent(NotificationEvent):
|
|||
return actual_level_index <= filter_level_index
|
||||
|
||||
def get_summary(self, event_data, notification_data):
|
||||
msg = '%s vulnerability detected in repository %s in %s tags'
|
||||
return msg % (event_data['vulnerability']['priority'], event_data['repository'],
|
||||
len(event_data['tags']))
|
||||
multiple_vulns = event_data.get(VulnerabilityFoundEvent.MULTIPLE_VULNERABILITY_KEY)
|
||||
if multiple_vulns is not None:
|
||||
msg = '%s vulnerabilities were detected in repository %s in %s tags'
|
||||
return msg % (len(multiple_vulns), event_data['repository'], len(event_data['tags']))
|
||||
else:
|
||||
msg = '%s vulnerability detected in repository %s in %s tags'
|
||||
return msg % (event_data['vulnerability']['priority'], event_data['repository'],
|
||||
len(event_data['tags']))
|
||||
|
||||
|
||||
class BaseBuildEvent(NotificationEvent):
|
||||
|
|
Reference in a new issue