Skip to content

Commit

Permalink
feat(general): add logs for suppression (#6873)
Browse files Browse the repository at this point in the history
* add logs for suppression

* add logs for suppression

* add logs for suppression

* add logs for suppression
  • Loading branch information
lirshindalman authored Nov 25, 2024
1 parent 2c04409 commit 3090bb2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def post_runner(self, scan_report: Report) -> None:
self._apply_suppressions_to_report(scan_report)

def _apply_suppressions_to_report(self, scan_report: Report) -> None:

logging.debug('Start apply_suppressions_to_report')
# holds the checks that are still not suppressed
still_failed_checks = []
still_passed_checks = []
Expand All @@ -124,7 +124,8 @@ def _apply_suppressions_to_report(self, scan_report: Report) -> None:
relevant_suppressions_v2 = self.suppressions_v2.get(check.check_id)

has_suppression = relevant_suppressions or relevant_suppressions_v2

if isinstance(has_suppression, list):
logging.debug(f'(_apply_suppressions_to_report) - number of suppression {len(has_suppression)}')
applied_suppression = self._check_suppressions(check, relevant_suppressions, relevant_suppressions_v2) if has_suppression else None
if applied_suppression:
suppress_comment = applied_suppression['comment'] if applied_suppression['isV1'] else applied_suppression['justificationComment']
Expand Down Expand Up @@ -188,6 +189,7 @@ def _check_suppression(self, record: Record, suppression: dict[str, Any]) -> boo
# But checking here adds some resiliency against bugs if that changes.
return any(self.bc_integration.repo_matches(account) for account in suppression['accountIds'])
elif type == 'Resources':
logging.debug(f'check_suppression type Resources {suppression}. resource_id = {record.repo_file_path}:{record.resource} repo_id = {self.bc_integration.repo_id}')
for resource in suppression['resources']:
if self.bc_integration.repo_matches(resource['accountId']) \
and (resource['resourceId'] == f'{record.repo_file_path}:{record.resource}'
Expand Down

0 comments on commit 3090bb2

Please sign in to comment.