Skip to content

Commit f6c5f17

Browse files
committed
ruff
1 parent 1f05282 commit f6c5f17

2 files changed

Lines changed: 16 additions & 17 deletions

File tree

dojo/tools/cycognito/parser.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def get_findings(self, file, test):
3333
attacker_interest = vulnerability.get("attacker_interest", None)
3434
tags = vulnerability.get("tags", None)
3535
base_severity_score = vulnerability.get("base_severity_score", None)
36-
id = vulnerability.get("id", None)
36+
vulnid = vulnerability.get("id", None)
3737
remediation_method = vulnerability.get("remediation_method", None)
3838
issue_id = vulnerability.get("issue_id", None)
3939
first_detected = vulnerability.get("first_detected", None)
@@ -77,7 +77,7 @@ def get_findings(self, file, test):
7777
if tools and tools is not None:
7878
description += "**tools:** " + str(tools) + "\n"
7979
if continent and continent is not None:
80-
description += "**continent:** " + str(', '.join(continent)) + "\n"
80+
description += "**continent:** " + str(", ".join(continent)) + "\n"
8181
if tech_owners and tech_owners is not None:
8282
description += "**tech_owners:** " + str(tech_owners) + "\n"
8383
if teams and teams is not None:
@@ -90,8 +90,8 @@ def get_findings(self, file, test):
9090
description += "**tags:** " + str(tags) + "\n"
9191
if base_severity_score is not None:
9292
description += "**base_severity_score:** " + str(base_severity_score) + "\n"
93-
if id is not None:
94-
description += "**id:** " + str(id) + "\n"
93+
if vulnid is not None:
94+
description += "**id:** " + str(vulnid) + "\n"
9595
if remediation_method is not None:
9696
mitigation += "**remediation_method:** " + str(remediation_method) + "\n"
9797
if issue_id is not None:
@@ -109,17 +109,17 @@ def get_findings(self, file, test):
109109
if attractiveness_label is not None:
110110
description += "**attractiveness_label:** " + str(attractiveness_label) + "\n"
111111
if affected_ptr_domains and affected_ptr_domains is not None:
112-
description += "**affected_ptr_domains:** " + str(', '.join(affected_ptr_domains)) + "\n"
112+
description += "**affected_ptr_domains:** " + str(", ".join(affected_ptr_domains)) + "\n"
113113
if affected_asset_tags and affected_asset_tags is not None:
114-
description += "**affected_asset_tags:** " + str() + "\n"
114+
description += "**affected_asset_tags:** " + "" + "\n"
115115
if advisories and advisories is not None:
116116
description += "**advisories:** " + str(advisories) + "\n"
117117
if environments and environments is not None:
118-
description += "**environments:** " + str(', '.join(environments)) + "\n"
118+
description += "**environments:** " + str(", ".join(environments)) + "\n"
119119
if locations and locations is not None:
120-
description += "**locations:** " + str(', '.join(locations)) + "\n"
120+
description += "**locations:** " + str(", ".join(locations)) + "\n"
121121
if region and region is not None:
122-
description += "**region:** " + str(', '.join(region)) + "\n"
122+
description += "**region:** " + str(", ".join(region)) + "\n"
123123
if detection_complexity is not None:
124124
description += "**detection_complexity:** " + str(detection_complexity) + "\n"
125125
if port is not None:
@@ -131,32 +131,32 @@ def get_findings(self, file, test):
131131
if attractiveness is not None:
132132
description += "**attractiveness:** " + str(attractiveness) + "\n"
133133
if platforms is not None:
134-
description += "**platforms:** " + str(', '.join(platforms)) + "\n"
134+
description += "**platforms:** " + str(", ".join(platforms)) + "\n"
135135
if exploitation_score is not None:
136136
description += "**exploitation_score:** " + str(exploitation_score) + "\n"
137137
if issue_type is not None:
138138
description += "**issue_type:** " + str(issue_type) + "\n"
139139
if organizations is not None:
140-
description += "**organizations:** " + str(', '.join(organizations)) + "\n"
140+
description += "**organizations:** " + str(", ".join(organizations)) + "\n"
141141
if business_units is not None:
142-
description += "**business_units:** " + str(', '.join(business_units)) + "\n"
142+
description += "**business_units:** " + str(", ".join(business_units)) + "\n"
143143
if comment is not None:
144144
description += "**comment:** " + str(comment) + "\n"
145145
if evidence is not None:
146146
description += "**evidence:** " + str(evidence) + "\n"
147147
if remediation_steps is not None:
148-
mitigation += "**remediation_steps:** " + str('\n '.join(remediation_steps)) + "\n"
148+
mitigation += "**remediation_steps:** " + str("\n ".join(remediation_steps)) + "\n"
149149
if potential_impact and potential_impact is not None:
150-
description += "**potential_impact:** " + str(', '.join(potential_impact)) + "\n"
150+
description += "**potential_impact:** " + str(", ".join(potential_impact)) + "\n"
151151
finding = Finding(
152152
title=title,
153153
test=test,
154154
description=description,
155155
severity=base_severity.capitalize(),
156-
references=str('\n'.join(references)),
156+
references=str("\n".join(references)),
157157
date=datetime.strptime(first_detected, "%Y-%m-%dT%H:%M:%S.%fZ").strftime("%Y-%m-%d"),
158158
dynamic_finding=True,
159-
mitigation=mitigation
159+
mitigation=mitigation,
160160
)
161161
if cve_ids and cve_ids is not None:
162162
finding.unsaved_vulnerability_ids = []

unittests/tools/test_cycognito_parser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from datetime import date
21

32
from dojo.models import Test
43
from dojo.tools.cycognito.parser import CycognitoParser

0 commit comments

Comments
 (0)