Skip to content

Commit 7b59da4

Browse files
authored
minor bugfixes (#440)
1 parent 90253ae commit 7b59da4

File tree

1 file changed

+14
-11
lines changed
  • packages/reporting-lib/src/reporting_lib

1 file changed

+14
-11
lines changed

packages/reporting-lib/src/reporting_lib/htmlgen.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,16 @@ def parse_depscan_report(self, depscan_report):
300300
previous_line = line
301301
line = current_line.strip()
302302

303+
# ---- Dirty fix for unusually structured sections ----
304+
305+
if current_location != self.REACHABLE_FLOWS_DATA and last_seen_reachable_flows in [self.REACHABLE_FLOWS, None]:
306+
if line.startswith("#") or self.string_matches_regex(line, r'<span class="r\d+">#\d+<\/span><span class="r\d+">.*<\/span>'):
307+
current_location = self.REACHABLE_FLOWS_DATA
308+
309+
if current_location != self.NON_REACHABLE_FLOWS_DATA and last_seen_reachable_flows == self.NON_REACHABLE_FLOWS:
310+
if line.startswith("#") or self.string_matches_regex(line, r'<span class="r\d+">#\d+<\/span><span class="r\d+">.*<\/span>'):
311+
current_location = self.NON_REACHABLE_FLOWS_DATA
312+
303313
# ---- Location identification: Secure Design Tips ----
304314

305315
if line == self.SECURE_DESIGN_TIPS or self.string_matches_span_pattern(
@@ -314,9 +324,10 @@ def parse_depscan_report(self, depscan_report):
314324
# ---- Data population: Secure Design Tips ----
315325

316326
if current_location == self.SECURE_DESIGN_TIPS:
317-
if sections_tree[self.SECURE_DESIGN_TIPS][self.SUMMARY] != "":
318-
sections_tree[self.SECURE_DESIGN_TIPS][self.SUMMARY] += "\n"
319-
sections_tree[self.SECURE_DESIGN_TIPS][self.SUMMARY] += line
327+
if line not in sections_tree[self.SECURE_DESIGN_TIPS][self.SUMMARY]:
328+
if sections_tree[self.SECURE_DESIGN_TIPS][self.SUMMARY] != "":
329+
sections_tree[self.SECURE_DESIGN_TIPS][self.SUMMARY] += "\n"
330+
sections_tree[self.SECURE_DESIGN_TIPS][self.SUMMARY] += line
320331
continue
321332

322333
# ---- Location identification: INFO ----
@@ -719,14 +730,6 @@ def parse_depscan_report(self, depscan_report):
719730
last_seen_reachable_flows = self.REACHABLE_FLOWS
720731
continue
721732

722-
if current_location != self.REACHABLE_FLOWS_DATA and last_seen_reachable_flows in [self.REACHABLE_FLOWS, None]:
723-
if line.startswith("#") or self.string_matches_regex(line, r'<span class="r\d+">#\d+<\/span><span class="r\d+">.*<\/span>'):
724-
current_location = self.REACHABLE_FLOWS_DATA
725-
726-
if current_location != self.NON_REACHABLE_FLOWS_DATA and last_seen_reachable_flows == self.NON_REACHABLE_FLOWS:
727-
if line.startswith("#") or self.string_matches_regex(line, r'<span class="r\d+">#\d+<\/span><span class="r\d+">.*<\/span>'):
728-
current_location = self.NON_REACHABLE_FLOWS_DATA
729-
730733
# ---- Data population: Reachable Flows ----
731734

732735
if current_location == self.REACHABLE_FLOWS_RECOMMENDATION:

0 commit comments

Comments
 (0)