Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Varsano committed Jul 4, 2023
1 parent cb5681b commit a253eb8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions checkov/common/sca/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def add_cve_record_to_report(vulnerability_details: dict[str, Any], package_name
used_private_registry=used_private_registry
)
suppressed = apply_cves_inline_suppressions(
record=cve_record, vulnerability_details=vulnerability_details, inline_suppressions_maps=inline_suppressions_maps
record=cve_record, inline_suppressions_maps=inline_suppressions_maps
)

if not suppressed and not runner_filter.should_run_check(
Expand All @@ -458,13 +458,13 @@ def add_cve_record_to_report(vulnerability_details: dict[str, Any], package_name


def apply_cves_inline_suppressions(
record: Record, vulnerability_details: dict[str, Any], inline_suppressions_maps: _ScaSuppressionsMaps | None = None
record: Record, inline_suppressions_maps: _ScaSuppressionsMaps | None = None
) -> bool:
"""Applies the inline suppression and returns an accomplish status"""

if inline_suppressions_maps:
if inline_suppressions_maps.get("cve_by_cve_map"):
cve_suppression = inline_suppressions_maps["cve_by_cve_map"].get(vulnerability_details.get("cveId", ""))
cve_suppression = inline_suppressions_maps["cve_by_cve_map"].get(record.vulnerability_details.get("id", ""))
if cve_suppression:
record.check_result = {
"result": CheckResult.SKIPPED,
Expand Down
3 changes: 2 additions & 1 deletion checkov/common/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ class _SkippedCheck(TypedDict, total=False):


class _ScaSuppressionsMaps(TypedDict, total=False):
cve_by_cve_map: dict[str, _SuppressedCves]
cve_by_cveap: dict[str, _SuppressedCves]
licenses_by_policy_and_package_map: dict[str, _SuppressedLicenses]


# _ScaSuppressions fields are in camel case because this is the output of the server report
class _ScaSuppressions(TypedDict, total=False):
cves: _CvesSuppressions
licenses: _LicensesSuppressions
Expand Down
4 changes: 2 additions & 2 deletions tests/sca_package_2/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def test_run(sca_package_2_report):
}

assert len(report.passed_checks) == 3
assert len(report.failed_checks) == 9
assert len(report.skipped_checks) == 1
assert len(report.failed_checks) == 7
assert len(report.skipped_checks) == 3
assert len(report.parsing_errors) == 0

cve_record = next((c for c in report.failed_checks if
Expand Down

0 comments on commit a253eb8

Please sign in to comment.