Skip to content

Commit

Permalink
fix(report): do not remove duplicate in reports by default (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocervell committed May 6, 2024
1 parent 5a87d7b commit 7d74ae8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions secator/config.py
Expand Up @@ -74,6 +74,7 @@ class Runners(StrictModel):
progress_update_frequency: int = 60
skip_cve_search: bool = False
skip_cve_low_confidence: bool = True
remove_duplicates: bool = False


class HTTP(StrictModel):
Expand Down
5 changes: 4 additions & 1 deletion secator/report.py
@@ -1,5 +1,6 @@
import operator

from secator.config import CONFIG
from secator.output_types import OUTPUT_TYPES, OutputType
from secator.utils import merge_opts, get_file_timestamp
from secator.rich import console
Expand Down Expand Up @@ -64,8 +65,10 @@ def build(self):
sort_by, _ = get_table_fields(output_type)
items = [
item for item in self.runner.results
if isinstance(item, OutputType) and item._type == output_name and not item._duplicate
if isinstance(item, OutputType) and item._type == output_name
]
if CONFIG.runners.remove_duplicates:
items = [item for item in items if not item._duplicate]
if items:
if sort_by and all(sort_by):
items = sorted(items, key=operator.attrgetter(*sort_by))
Expand Down
4 changes: 3 additions & 1 deletion secator/utils.py
Expand Up @@ -343,8 +343,10 @@ def print_results_table(results, title=None, exclude_fields=[], log=False):
if output_type.__name__ == 'Progress':
continue
items = [
item for item in results if item._type == output_type.get_name() and not item._duplicate
item for item in results if item._type == output_type.get_name()
]
if CONFIG.runners.remove_duplicates:
items = [item for item in items if not item._duplicate]
if items:
_table = build_table(
items,
Expand Down

0 comments on commit 7d74ae8

Please sign in to comment.