Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: re-evaluate unpatched CVEs in recalc #1745

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions evaluator/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ async def _evaluate_vmaas_res(
sys_vuln_rows: dict,
system_platform: SystemPlatform,
conn: AsyncConnection,
recalc_event_id: Optional[int] = None,
) -> dict:
"""Insert vmaas cve results"""

Expand Down Expand Up @@ -539,11 +538,6 @@ async def _evaluate_vmaas_res(
None,
)

# if this is a re-evaluation, it means it was triggered by a new erratum in repository => don't change unfixed CVEs
# the change of unfixed CVEs in oval/csaf is not covered, it'll be handled only by evaluator_upload for now
if recalc_event_id:
return sys_vuln_rows

# aggregate unfixed cves, get (package name, cpe, module) tuples and list of cves for these pairs
pn_cpes = {}
for cve_unpatched in unpatched_cves:
Expand Down Expand Up @@ -694,9 +688,7 @@ async def _evaluate_advisor_res(

return sys_vuln_rows

async def evaluate_vulnerabilities(
self, system_platform: SystemPlatform, conn: AsyncConnection, recalc_event_id: Optional[int] = None
) -> Dict[str, SystemVulnerabilitiesRow]:
async def evaluate_vulnerabilities(self, system_platform: SystemPlatform, conn: AsyncConnection) -> Dict[str, SystemVulnerabilitiesRow]:
"""Evaluate cve hits from vmaas and advisor"""
sys_vuln_rows = {}

Expand All @@ -710,7 +702,6 @@ async def evaluate_vulnerabilities(
sys_vuln_rows,
system_platform,
conn,
recalc_event_id=recalc_event_id,
)
if system_platform.rule_results:
# set of unpatched cves from vmaas for exclusion from advisor evaluation
Expand Down
2 changes: 1 addition & 1 deletion evaluator/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ async def _evaluate_system(
# start both task asynchronously to speed up
sys_vuln_rows_db, sys_vuln_rows = await asyncio.gather(
self._load_db_system_vulnerabilities(system_platform, conn),
self.evaluator_logic.evaluate_vulnerabilities(system_platform, conn, recalc_event_id=recalc_event_id),
self.evaluator_logic.evaluate_vulnerabilities(system_platform, conn),
)

to_insert, to_update, to_delete = await self._compare_sys_vulns(sys_vuln_rows_db, sys_vuln_rows)
Expand Down
Loading