mirror of
https://forgejo.altau.su/lego/lego-monitoring.git
synced 2026-03-10 04:41:10 +00:00
meaningful exception handling for vulnix
This commit is contained in:
parent
d78d21c312
commit
c355583f59
1 changed files with 3 additions and 5 deletions
|
|
@ -2,7 +2,6 @@ from socket import gethostname
|
||||||
|
|
||||||
from lego_monitoring.alerting.alert import Alert
|
from lego_monitoring.alerting.alert import Alert
|
||||||
from lego_monitoring.alerting.enum import AlertType, Severity
|
from lego_monitoring.alerting.enum import AlertType, Severity
|
||||||
from lego_monitoring.alerting.sender import send_alert
|
|
||||||
|
|
||||||
from ..utils import format_for_healthchecks_slug
|
from ..utils import format_for_healthchecks_slug
|
||||||
from .vulnix import get_vulnix_output
|
from .vulnix import get_vulnix_output
|
||||||
|
|
@ -16,15 +15,14 @@ async def vulnix_check() -> list[Alert]:
|
||||||
try:
|
try:
|
||||||
vulnix_output = get_vulnix_output(IS_TESTING)
|
vulnix_output = get_vulnix_output(IS_TESTING)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await send_alert(
|
return [
|
||||||
Alert(
|
Alert(
|
||||||
alert_type=AlertType.ERROR,
|
AlertType.VULN,
|
||||||
message=f"Exception {type(e).__name__} while calling vulnix: {e}",
|
message=f"Exception {type(e).__name__} while calling vulnix: {e}",
|
||||||
severity=Severity.CRITICAL,
|
severity=Severity.CRITICAL,
|
||||||
healthchecks_slug=slug,
|
healthchecks_slug=slug,
|
||||||
)
|
)
|
||||||
)
|
]
|
||||||
return []
|
|
||||||
for finding in vulnix_output:
|
for finding in vulnix_output:
|
||||||
if not IS_TESTING:
|
if not IS_TESTING:
|
||||||
non_whitelisted_cves = [k for k in finding.description if k not in finding.whitelisted]
|
non_whitelisted_cves = [k for k in finding.description if k not in finding.whitelisted]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue