Skip to content

Commit b3785cf

Browse files
authored
added cve to table (#109)
* added cve to table * minor refactoring
1 parent a4a37f2 commit b3785cf

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

cycode/cli/printers/table_printer.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
LICENSE_COLUMN = 'License'
1313
UPGRADE_COLUMN = 'Upgrade'
1414
REPOSITORY_COLUMN = 'Repository'
15+
CVE_COLUMN = 'CVE'
1516
PREVIEW_DETECTIONS_COMMON_HEADERS = ['File Path', 'Ecosystem', 'Dependency Name',
1617
'Direct Dependency',
1718
'Development Dependency']
@@ -42,7 +43,8 @@ def print_results(self, results: List[DocumentDetections]):
4243
if self.context.obj.get('report_url'):
4344
click.secho(f"Report URL: {self.context.obj.get('report_url')}")
4445

45-
def _extract_detections_per_detection_type_id(self, results: List[DocumentDetections]):
46+
@staticmethod
47+
def _extract_detections_per_detection_type_id(results: List[DocumentDetections]):
4648
detections_per_detection_type_id = {}
4749

4850
for document_detection in results:
@@ -57,21 +59,22 @@ def _print_detection_per_detection_type_id(self, detections_per_detection_type_i
5759
for detection_type_id in detections_per_detection_type_id:
5860
detections = detections_per_detection_type_id[detection_type_id]
5961
headers = self._get_table_headers()
62+
rows = []
63+
title = ""
6064

6165
if detection_type_id == PACKAGE_VULNERABILITY_POLICY_ID:
6266
title = "Dependencies Vulnerabilities"
6367
headers = [SEVERITY_COLUMN] + headers
6468
headers.extend(PREVIEW_DETECTIONS_COMMON_HEADERS)
69+
headers.append(CVE_COLUMN)
6570
headers.append(UPGRADE_COLUMN)
66-
rows = []
6771
for detection in detections:
6872
rows.append(self._get_upgrade_package_vulnerability(detection))
6973

7074
if detection_type_id == LICENSE_COMPLIANCE_POLICY_ID:
7175
title = "License Compliance"
7276
headers.extend(PREVIEW_DETECTIONS_COMMON_HEADERS)
7377
headers.append(LICENSE_COLUMN)
74-
rows = []
7578
for detection in detections:
7679
rows.append(self._get_license(detection))
7780

@@ -96,13 +99,15 @@ def _print_table_detections(self, detections: List[Detection], headers: List[str
9699
text_table.add_row(row)
97100
click.echo(text_table.draw())
98101

99-
def set_table_width(self, headers, text_table):
102+
@staticmethod
103+
def set_table_width(headers, text_table):
100104
header_width_size_cols = []
101105
for header in headers:
102106
header_width_size_cols.append(len(header))
103107
text_table.set_cols_width(header_width_size_cols)
104108

105-
def _print_summary_issues(self, detections: List, title: str):
109+
@staticmethod
110+
def _print_summary_issues(detections: List, title: str):
106111
click.echo(
107112
f'⛔ Found {len(detections)} issues of type: {click.style(title, bold=True)}')
108113

@@ -112,7 +117,8 @@ def _get_common_detection_fields(self, detection: Detection):
112117
detection.detection_details.get('ecosystem'),
113118
detection.detection_details.get('package_name'),
114119
detection.detection_details.get('is_direct_dependency_str'),
115-
detection.detection_details.get('is_dev_dependency_str')
120+
detection.detection_details.get('is_dev_dependency_str'),
121+
detection.detection_details.get('vulnerability_id')
116122
]
117123

118124
if self._is_git_repository():

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "cycode"
3-
version = "0.0.0" # placeholder. Will be filled automatically on poetry build from Git Tag
3+
version = "0.2.4.dev8" # placeholder. Will be filled automatically on poetry build from Git Tag
44
description = "Perform secrets/iac scans for your sources using Cycode's engine"
55
keywords=["secret-scan", "cycode", "devops", "token", "secret", "security", "cycode", "code"]
66
authors = ["Cycode <[email protected]>"]
@@ -49,7 +49,7 @@ responses = ">=0.23.1,<0.24.0"
4949

5050
# poetry self add "poetry-dynamic-versioning[plugin]"
5151
[tool.poetry-dynamic-versioning]
52-
enable = true
52+
enable = false
5353
strict = true
5454
bump = true
5555
metadata = false

0 commit comments

Comments
 (0)