├── LICENSE
├── README.md
├── index.html
├── requirements.txt
├── sample.html
├── sample_enriched.html
└── sunshine.py
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ```
2 | ▗▄▄▖▗▖ ▗▖▗▖ ▗▖ ▗▄▄▖▗▖ ▗▖▗▄▄▄▖▗▖ ▗▖▗▄▄▄▖
3 | ▐▌ ▐▌ ▐▌▐▛▚▖▐▌▐▌ ▐▌ ▐▌ █ ▐▛▚▖▐▌▐▌
4 | ▝▀▚▖▐▌ ▐▌▐▌ ▝▜▌ ▝▀▚▖▐▛▀▜▌ █ ▐▌ ▝▜▌▐▛▀▀▘
5 | ▗▄▄▞▘▝▚▄▞▘▐▌ ▐▌▗▄▄▞▘▐▌ ▐▌▗▄█▄▖▐▌ ▐▌▐▙▄▄▖
6 | ```
7 |
8 | Sunshine: actionable CycloneDX visualization tool.
9 |
10 | It takes a JSON CycloneDX file as input and provides as output an HTML containing a chart and table representation of the components, dependencies, vulnerabilities and licenses. It can also enrich data by adding EPSS and CISA KEV information. See a sample HTML output [here without enriched data](https://cyclonedx.github.io/Sunshine/sample.html) and [here with enriched data](https://cyclonedx.github.io/Sunshine/sample_enriched.html).
11 |
12 |
13 |
14 | Can be used in 2 ways:
15 | - As a web application: all submitted data is processed locally within your browser, without being transmitted anywhere else.
16 | - As a standalone CLI tool.
17 |
18 |
19 | Usage of the web application:
20 | - option 1: via the online version at URL https://cyclonedx.github.io/Sunshine/
21 | - option 2: by running `python3 -m http.server 8000` and opening a browser at URL http://127.0.0.1:8000
22 |
23 |
24 | Usage of the CLI version:
25 |
26 | ```
27 | pip3 install -r requirements.txt
28 |
29 | sunshine.py [-h] [-v] [-i INPUT] [-o OUTPUT]
30 |
31 | options:
32 | -h, --help show this help message and exit
33 | -v, --version show program version
34 | -i, --input INPUT path of input CycloneDX file
35 | -o, --output OUTPUT path of output HTML file
36 | -e, --enrich enrich CVEs with EPSS and CISA KEV
37 | ```
38 |
39 |
40 |
41 | Credits:
42 | - made by: [Luca Capacci](https://www.linkedin.com/in/lucacapacci/)
43 | - contributor: [Mattia Fierro](https://www.linkedin.com/in/mattiafierro/)
44 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Select a CycloneDX JSON file from your file system. All submitted data is processed locally within your browser, without being transmitted anywhere else.
176 |
199 | This chart visualizes components and their dependencies, with each segment representing a single component. The chart provides a hierarchical view of the dependency structure, with relationships radiating outward from the core components.
200 |
201 |
Innermost circle: represents components that are independent and not dependencies for any other components.
202 |
Outer circles: each segment represents a dependency of the corresponding segment in the circle immediately inside it. The farther a segment is from the center, the deeper the dependency level.
203 |
204 | Note: If there is only one circle, it means that no dependency relationships are defined in the input file.
205 |
206 | The colors of the segments indicate the vulnerability status of the components:
207 |
208 |
Dark red: affected by at least one critical severity vulnerability.
209 |
Red: affected by at least one high severity vulnerability.
210 |
Orange: affected by at least one medium severity vulnerability.
211 |
Yellow: affected by at least one low severity vulnerability.
212 |
Green: affected by at least one informational severity vulnerability.
213 |
Light blue: not directly affected by vulnerabilities but has at least one vulnerable dependency.
214 |
Grey: neither the component nor its dependencies are affected by any vulnerabilities.
215 |
216 | The chart is interactive:
217 |
218 |
Hovering: displays details about a component, including its name, version, and list of vulnerabilities.
219 |
Clicking: refocuses the chart. The clicked segment becomes the center (second innermost circle), showing only that component and its dependencies. In this view, the innermost circle is always blue. Clicking the blue circle navigates back up one level in the dependency hierarchy.
220 |
221 |
222 |
223 |
224 |
227 |
228 |
229 |
230 |
233 |
234 |
235 |
236 |
237 |
238 |
239 | Chart will appear here...
240 |
241 |
242 |
Components table
243 |
244 | This table visualizes components, their dependencies, vulnerabilities and licenses.
245 | The colors of the elements in columns "Component", "Depends on" and "Dependency of" indicate the vulnerability status of the components:
246 |
247 |
Dark red: affected by at least one critical severity vulnerability.
248 |
Red: affected by at least one high severity vulnerability.
249 |
Orange: affected by at least one medium severity vulnerability.
250 |
Yellow: affected by at least one low severity vulnerability.
251 |
Green: affected by at least one informational severity vulnerability.
252 |
Light blue: not directly affected by vulnerabilities but has at least one vulnerable dependency.
253 |
Grey: neither the component nor its dependencies are affected by any vulnerabilities.
254 |
255 |
256 | The colors of the elements in columns "Direct vulnerabilities" and "Transitive vulnerabilities" indicate the severity of the vulnerabilities:
257 |
258 |
Dark red: critical.
259 |
Red: high.
260 |
Orange: medium.
261 |
Yellow:low.
262 |
Green:informational.
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 | Components table will appear here...
271 |
272 |
273 |
274 |
Vulnerabilities table
275 |
276 | This table focuses on vulnerabilities and shows the components that are affected either directly or transitively.
277 | The colors of the elements in column "Vulnerability" indicate the severity of the vulnerabilities:
278 |
279 |
Dark red: critical.
280 |
Red: high.
281 |
Orange: medium.
282 |
Yellow:low.
283 |
Green:informational.
284 |
285 |
286 | The colors of the elements in columns "Directly vulnerable components" and "Transitively vulnerable components" indicate the vulnerability status of the components:
287 |
288 |
Dark red: affected by at least one critical severity vulnerability.
289 |
Red: affected by at least one high severity vulnerability.
290 |
Orange: affected by at least one medium severity vulnerability.
291 |
Yellow: affected by at least one low severity vulnerability.
292 |
Green: affected by at least one informational severity vulnerability.
293 |
Light blue: not directly affected by vulnerabilities but has at least one vulnerable dependency.
294 |
295 |
296 |
297 |
298 |
299 |
300 | Vulnerabilities table will appear here...
301 |
302 |
303 |
304 |
Log
305 |
Log will appear here...
306 |
307 |
308 |
309 |
695 |
696 |
697 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | requests
2 |
--------------------------------------------------------------------------------
/sunshine.py:
--------------------------------------------------------------------------------
1 | # This file is part of CycloneDX Sunshine
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | # SPDX-License-Identifier: Apache-2.0
16 | # Copyright (c) OWASP Foundation. All Rights Reserved.
17 |
18 |
19 | __all__ = [
20 | # This module does not export any symbols; all sumbols are private/internal.
21 | ]
22 |
23 | import json
24 | import argparse
25 | import os
26 | import html
27 | import copy
28 | import re
29 | import requests
30 | import csv
31 | from decimal import Decimal
32 |
33 |
34 | VERSION = "0.9"
35 | NAME = "Sunshine"
36 |
37 | PREFERRED_VULNERABILITY_RATING_METHODS_ORDER = ["CVSSv4",
38 | "CVSSv31",
39 | "CVSSv3",
40 | "CVSSv2",
41 | "OWASP",
42 | "SSVC",
43 | "other"]
44 |
45 | VALID_SEVERITIES = {"critical": 4,
46 | "high": 3,
47 | "medium": 2,
48 | "low": 1,
49 | "info": 0,
50 | "information": 0,
51 | "clean": -1}
52 |
53 | GREY = '#bcbcbc'
54 | GREEN = '#7dd491'
55 | YELLOW = '#fccd58'
56 | ORANGE = '#ff9335'
57 | RED = '#ff4633'
58 | DARK_RED = '#a10a0a'
59 | LIGHT_BLUE = '#9fc5e8'
60 |
61 | BASIC_STYLE = { "color": GREY, "borderWidth": 2 }
62 | INFORMATION_STYLE = { "color": GREEN, "borderWidth": 2 }
63 | LOW_STYLE = { "color": YELLOW, "borderWidth": 2 }
64 | MEDIUM_STYLE = { "color": ORANGE, "borderWidth": 2 }
65 | HIGH_STYLE = { "color": RED, "borderWidth": 2 }
66 | CRITICAL_STYLE = { "color": DARK_RED, "borderWidth": 2 }
67 | TRANSITIVE_VULN_STYLE = { "color": LIGHT_BLUE, "borderWidth": 2 }
68 |
69 |
70 | STYLES = {"critical": CRITICAL_STYLE,
71 | "high": HIGH_STYLE,
72 | "medium": MEDIUM_STYLE,
73 | "low": LOW_STYLE,
74 | "information": INFORMATION_STYLE,
75 | "clean": BASIC_STYLE}
76 |
77 |
78 | HTML_TEMPLATE = """
79 |
80 |
81 |
82 |
83 |
84 | Sunshine - SBOM visualization tool
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
244 |
245 |
246 |
247 |
248 |
Sunshine - SBOM visualization tool
249 |
250 |
251 | Analyzed CycloneDX JSON file:
252 |
253 |
254 |
255 |
Summary
256 |
257 |
258 |
259 |
260 |
261 |
Components chart
262 |
263 | This chart visualizes components and their dependencies, with each segment representing a single component. The chart provides a hierarchical view of the dependency structure, with relationships radiating outward from the core components.
264 |
265 |
Innermost circle: represents components that are independent and not dependencies for any other components.
266 |
Outer circles: each segment represents a dependency of the corresponding segment in the circle immediately inside it. The farther a segment is from the center, the deeper the dependency level.
267 |
268 | Note: If there is only one circle, it means that no dependency relationships are defined in the input file.
269 |
270 | The colors of the segments indicate the vulnerability status of the components:
271 |
272 |
Dark red: affected by at least one critical severity vulnerability.
273 |
Red: affected by at least one high severity vulnerability.
274 |
Orange: affected by at least one medium severity vulnerability.
275 |
Yellow: affected by at least one low severity vulnerability.
276 |
Green: affected by at least one informational severity vulnerability.
277 |
Light blue: not directly affected by vulnerabilities but has at least one vulnerable dependency.
278 |
Grey: neither the component nor its dependencies are affected by any vulnerabilities.
279 |
280 | The chart is interactive:
281 |
282 |
Hovering: displays details about a component, including its name, version, and list of vulnerabilities.
283 |
Clicking: refocuses the chart. The clicked segment becomes the center (second innermost circle), showing only that component and its dependencies. In this view, the innermost circle is always blue. Clicking the blue circle navigates back up one level in the dependency hierarchy.
284 |
285 |
286 |
287 |
288 |
291 |
292 |
293 |
294 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
Components table
304 |
305 | This table visualizes components, their dependencies, vulnerabilities and licenses.
306 | The colors of the elements in columns "Component", "Depends on" and "Dependency of" indicate the vulnerability status of the components:
307 |
308 |
Dark red: affected by at least one critical severity vulnerability.
309 |
Red: affected by at least one high severity vulnerability.
310 |
Orange: affected by at least one medium severity vulnerability.
311 |
Yellow: affected by at least one low severity vulnerability.
312 |
Green: affected by at least one informational severity vulnerability.
313 |
Light blue: not directly affected by vulnerabilities but has at least one vulnerable dependency.
314 |
Grey: neither the component nor its dependencies are affected by any vulnerabilities.
315 |
316 |
317 | The colors of the elements in columns "Direct vulnerabilities" and "Transitive vulnerabilities" indicate the severity of the vulnerabilities:
318 |
319 |
Dark red: critical.
320 |
Red: high.
321 |
Orange: medium.
322 |
Yellow:low.
323 |
Green:informational.
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
Vulnerabilities table
332 |
333 | This table focuses on vulnerabilities and shows the components that are affected either directly or transitively.
334 | The colors of the elements in column "Vulnerability" indicate the severity of the vulnerabilities:
335 |
336 |
Dark red: critical.
337 |
Red: high.
338 |
Orange: medium.
339 |
Yellow:low.
340 |
Green:informational.
341 |
342 |
343 | The colors of the elements in columns "Directly vulnerable components" and "Transitively vulnerable components" indicate the vulnerability status of the components:
344 |
345 |
Dark red: affected by at least one critical severity vulnerability.
346 |
Red: affected by at least one high severity vulnerability.
347 |
Orange: affected by at least one medium severity vulnerability.
348 |
Yellow: affected by at least one low severity vulnerability.
349 |
Green: affected by at least one informational severity vulnerability.
350 |
Light blue: not directly affected by vulnerabilities but has at least one vulnerable dependency.
351 |
352 |
353 |
354 |
355 |
586 |
587 |
588 |
589 |
590 | """
591 |
592 |
593 | def custom_print(text):
594 | if __name__ == "__web__":
595 | from js import writeToLog
596 | writeToLog(text)
597 | else:
598 | print(text)
599 |
600 |
601 | class SetEncoder(json.JSONEncoder):
602 | def default(self, obj):
603 | if isinstance(obj, set):
604 | return list(obj)
605 | return super().default(obj)
606 |
607 |
608 | def create_fake_component(bom_ref):
609 | return {"name": bom_ref,
610 | "version": "-",
611 | "type": "-",
612 | "license": set(),
613 | "depends_on": set(),
614 | "dependency_of": set(),
615 | "vulnerabilities": [],
616 | "transitive_vulnerabilities": [],
617 | "max_vulnerability_severity": "clean",
618 | "has_transitive_vulnerabilities": False,
619 | "visited": False}
620 |
621 |
622 | def create_base_component(component):
623 | new_component = {"name": component["name"],
624 | "version": component["version"] if "version" in component else "-",
625 | "type": component["type"] if "type" in component else "-",
626 | "license": parse_licenses(component),
627 | "depends_on": set(),
628 | "dependency_of": set(),
629 | "vulnerabilities": [],
630 | "transitive_vulnerabilities": [],
631 | "max_vulnerability_severity": "clean",
632 | "has_transitive_vulnerabilities": False,
633 | "visited": False}
634 |
635 | return new_component
636 |
637 | def get_severity_by_score(score):
638 | score = float(score)
639 | if score >= 9:
640 | return "critical"
641 | elif score >= 7:
642 | return "high"
643 | elif score >= 4:
644 | return "medium"
645 | elif score > 0:
646 | return "low"
647 | else:
648 | return "information"
649 |
650 |
651 | def get_preferred_vuln_source(source_1, source_2):
652 | source_1 = source_1.upper()
653 | source_2 = source_2.upper()
654 |
655 | if source_1 == "NVD":
656 | source_1_order = 0
657 | elif source_1 in ["-", "EPSS"]:
658 | source_1_order = 2
659 | else:
660 | source_1_order = 1
661 |
662 | if source_2 == "NVD":
663 | source_2_order = 0
664 | elif source_2 in ["-", "EPSS"]:
665 | source_2_order = 2
666 | else:
667 | source_2_order = 1
668 |
669 | if source_1_order < source_2_order:
670 | return source_1
671 | else:
672 | return source_2
673 |
674 |
675 | def parse_vulnerability_data(vulnerability):
676 | vuln_id = vulnerability["id"]
677 |
678 | vuln_severity = None
679 | vuln_score = 0.0
680 | vuln_vector = "-"
681 | vuln_source = "-"
682 | found_at_least_one = False
683 | if "ratings" in vulnerability:
684 | for preferred_rating_method in PREFERRED_VULNERABILITY_RATING_METHODS_ORDER:
685 | if found_at_least_one is True:
686 | break
687 | for rating in vulnerability["ratings"]:
688 | if "method" not in rating:
689 | continue
690 | if rating["method"] == preferred_rating_method:
691 | found_at_least_one = True
692 | current_vuln_score = 0.0
693 | current_vuln_vector = "-"
694 | current_vuln_source = "-"
695 | if "severity" in rating and rating["severity"].lower() in VALID_SEVERITIES:
696 | current_vuln_severity = rating["severity"]
697 | if current_vuln_severity.lower() == "info":
698 | current_vuln_severity = "information"
699 | current_vuln_severity = current_vuln_severity.lower()
700 | if "score" in rating:
701 | current_vuln_score = float(rating["score"])
702 | if "vector" in rating:
703 | current_vuln_vector = rating["vector"]
704 | if "source" in rating:
705 | if "name" in rating["source"]:
706 | current_vuln_source = rating["source"]["name"]
707 | elif "score" in rating:
708 | current_vuln_severity = get_severity_by_score(rating["score"])
709 | current_vuln_score = float(rating["score"])
710 | if "vector" in rating:
711 | current_vuln_vector = rating["vector"]
712 | if "source" in rating:
713 | if "name" in rating["source"]:
714 | current_vuln_source = rating["source"]["name"]
715 |
716 | if get_preferred_vuln_source(vuln_source, current_vuln_source) == current_vuln_source:
717 | vuln_severity = current_vuln_severity
718 | vuln_score = current_vuln_score
719 | vuln_vector = current_vuln_vector
720 | vuln_source = current_vuln_source
721 |
722 | if vuln_severity is None:
723 | if "ratings" not in vulnerability:
724 | custom_print(f"WARNING: vulnerability with id '{vulnerability['id']}' does not have a 'ratings' field. I'll set a default 'INFORMATION' severity...")
725 | vuln_severity = get_severity_by_score(0)
726 | elif len(vulnerability["ratings"]) == 0:
727 | custom_print(f"WARNING: vulnerability with id '{vulnerability['id']}' does have an empty 'ratings' field. I'll set a default 'INFORMATION' severity...")
728 | vuln_severity = get_severity_by_score(0)
729 | else:
730 | for rating in vulnerability["ratings"]:
731 | if "severity" in rating:
732 | rating_vuln_severity = rating["severity"]
733 | if rating_vuln_severity.lower() in VALID_SEVERITIES:
734 | vuln_severity = rating_vuln_severity.lower()
735 | if "score" in rating:
736 | vuln_score = float(rating["score"])
737 | if "vector" in rating:
738 | vuln_vector = rating["vector"]
739 | break
740 | if "score" in rating:
741 | vuln_severity = get_severity_by_score(rating["score"])
742 | vuln_score = float(rating["score"])
743 | if "vector" in rating:
744 | vuln_vector = rating["vector"]
745 | break
746 |
747 | if vuln_severity is None:
748 | custom_print(f"WARNING: could not detect severity of vulnerability with id '{vulnerability['id']}'. I'll set a default 'INFORMATION' severity...")
749 | vuln_severity = get_severity_by_score(0)
750 |
751 | print(f"{vuln_source=}")
752 | return vuln_id, vuln_severity, vuln_score, vuln_vector
753 |
754 |
755 | bom_ref_cache = {}
756 | def get_bom_ref(component_json, all_bom_refs):
757 | global bom_ref_cache
758 | if "bom-ref" in component_json:
759 | bom_ref = component_json["bom-ref"]
760 | return bom_ref
761 | else:
762 | bom_ref_cache_key = f"{component_json['name']} - {component_json['version']}"
763 | if bom_ref_cache_key in bom_ref_cache:
764 | return bom_ref_cache[f"{component_json['name']} - {component_json['version']}"]
765 |
766 | custom_print(f"WARNING: component with name '{component_json['name']}' and version '{component_json['version']}' does not have a 'bom-ref'. I'll search for a match...")
767 | for potential_bom_ref in all_bom_refs:
768 | guessed_name_01 = f'{component_json["name"]}@{component_json["version"]}'
769 | guessed_name_02 = f'{component_json["name"]}::{component_json["version"]}'
770 | guessed_name_03 = f'{component_json["name"]}:{component_json["version"]}'
771 |
772 | for test in [guessed_name_01, guessed_name_02, guessed_name_03]:
773 | if potential_bom_ref.endswith(f"/{test}"):
774 | custom_print(f"Match found: {potential_bom_ref}")
775 | bom_ref_cache[bom_ref_cache_key] = potential_bom_ref
776 | return potential_bom_ref
777 | if potential_bom_ref.endswith(f"/{test}:"):
778 | custom_print(f"Match found: {potential_bom_ref}")
779 | bom_ref_cache[bom_ref_cache_key] = potential_bom_ref
780 | return potential_bom_ref
781 | if potential_bom_ref.endswith(f":{test}"):
782 | bom_ref_cache[bom_ref_cache_key] = potential_bom_ref
783 | custom_print(f"Match found: {potential_bom_ref}")
784 | return potential_bom_ref
785 | if potential_bom_ref.endswith(f":{test}:"):
786 | bom_ref_cache[bom_ref_cache_key] = potential_bom_ref
787 | custom_print(f"Match found: {potential_bom_ref}")
788 | return potential_bom_ref
789 |
790 | # another try with version not in the end of the string
791 | number_of_results = 0
792 | result = None
793 | for potential_bom_ref in all_bom_refs:
794 | guessed_name_01 = f'{component_json["name"]}@{component_json["version"]}'
795 | guessed_name_02 = f'{component_json["name"]}::{component_json["version"]}'
796 | guessed_name_03 = f'{component_json["name"]}:{component_json["version"]}'
797 |
798 | for test in [guessed_name_01, guessed_name_02, guessed_name_03]:
799 | if f"/{test}:" in bom_ref:
800 | number_of_results += 1
801 | result = potential_bom_ref
802 | elif f":{test}:" in bom_ref:
803 | number_of_results += 1
804 | result = potential_bom_ref
805 | if number_of_results == 1: # I want just one result, otherwise it means the sbom is ambiguous and I can't make any educated guess
806 | bom_ref_cache[bom_ref_cache_key] = result
807 | return result
808 |
809 | custom_print(f"Match not found. I'll create a fake one.")
810 | bom_ref = f"{hash(json.dumps(component_json, sort_keys=True, cls=SetEncoder))}"
811 | bom_ref_cache[bom_ref_cache_key] = bom_ref
812 | return bom_ref
813 |
814 |
815 | def create_or_update_bom_ref_entry(bom_refs, component):
816 | if component["bom-ref"] not in bom_refs:
817 | bom_refs[component["bom-ref"]] = {"name": component["name"] if "name" in component else "-",
818 | "version": component["version"] if "version" in component else "-"}
819 | else:
820 | if bom_refs[component["bom-ref"]]["name"] == "-" and "name" in component:
821 | bom_refs[component["bom-ref"]]["name"] = component["name"]
822 | if bom_refs[component["bom-ref"]]["version"] == "-" and "version" in component:
823 | bom_refs[component["bom-ref"]]["version"] = component["version"]
824 |
825 |
826 | def normalize_bom_ref(bom_refs, bom_ref, only_valid_components=True):
827 | for component_bom_ref, component_data in bom_refs.items():
828 | if only_valid_components is False:
829 | if bom_ref == component_bom_ref:
830 | return bom_ref
831 | else:
832 | if bom_ref == component_bom_ref and component_data["name"] != "-" and component_data["version"] != "-":
833 | return bom_ref
834 |
835 | for component_bom_ref, component_data in bom_refs.items():
836 | # look with version
837 | guessed_name_01 = f'{component_data["name"]}@{component_data["version"]}'
838 | guessed_name_02 = f'{component_data["name"]}::{component_data["version"]}'
839 | guessed_name_03 = f'{component_data["name"]}:{component_data["version"]}'
840 |
841 | for test in [guessed_name_01, guessed_name_02, guessed_name_03]:
842 | if bom_ref.endswith(f"/{test}"):
843 | return bom_ref
844 | if bom_ref.endswith(f"/{test}:"):
845 | return bom_ref
846 | if bom_ref.endswith(f":{test}"):
847 | return bom_ref
848 | if bom_ref.endswith(f":{test}:"):
849 | return bom_ref
850 |
851 | # another try with version not in the end of the string
852 | number_of_results = 0
853 | result = None
854 | for component_bom_ref, component_data in bom_refs.items():
855 | guessed_name_01 = f'{component_data["name"]}@{component_data["version"]}'
856 | guessed_name_02 = f'{component_data["name"]}::{component_data["version"]}'
857 | guessed_name_03 = f'{component_data["name"]}:{component_data["version"]}'
858 |
859 | for test in [guessed_name_01, guessed_name_02, guessed_name_03]:
860 | if f"/{test}:" in bom_ref:
861 | number_of_results += 1
862 | result = component_bom_ref
863 | elif f":{test}:" in bom_ref:
864 | number_of_results += 1
865 | result = component_bom_ref
866 | if number_of_results == 1: # I want just one result, otherwise it means the sbom is ambiguous and I can't make any educated guess
867 | return result
868 |
869 | # final try: without version
870 | number_of_results = 0
871 | result = None
872 | for component_bom_ref, component_data in bom_refs.items():
873 | # look without version
874 | if f'/{component_data["name"]}@' in bom_ref:
875 | number_of_results += 1
876 | result = component_bom_ref
877 | elif f'/{component_data["name"]}:' in bom_ref:
878 | number_of_results += 1
879 | result = component_bom_ref
880 | elif f':{component_data["name"]}:' in bom_ref:
881 | number_of_results += 1
882 | result = component_bom_ref
883 | elif f':{component_data["name"]}@' in bom_ref:
884 | number_of_results += 1
885 | result = component_bom_ref
886 | if number_of_results == 1: # I want just one result, otherwise it means the sbom is ambiguous and I can't make any educated guess
887 | return result
888 |
889 | return None
890 |
891 |
892 | def has_bom_ref_components(bom_refs, bom_ref):
893 | return normalize_bom_ref(bom_refs, bom_ref, only_valid_components=False) is not None
894 |
895 |
896 | def add_nested_components(component, components, all_bom_refs):
897 | for child_key in ["services", "components"]:
898 | if child_key in component:
899 | for sub_component in component[child_key]:
900 | new_component = create_base_component(sub_component)
901 | bom_ref = get_bom_ref(sub_component, all_bom_refs)
902 | components[bom_ref] = new_component
903 | add_nested_components(sub_component, components, all_bom_refs)
904 |
905 |
906 | def detect_nested_bom_refs(component, bom_refs):
907 | for child_key in ["services", "components"]:
908 | if child_key in component:
909 | for sub_component in component[child_key]:
910 | if "bom-ref" in sub_component:
911 | create_or_update_bom_ref_entry(bom_refs, sub_component)
912 |
913 |
914 | def get_all_bom_refs(data):
915 | bom_refs = {}
916 | meta_bom_ref_is_used = False
917 |
918 | root_keywords = []
919 | if "components" in data:
920 | root_keywords.append("components")
921 | if "services" in data:
922 | root_keywords.append("services")
923 |
924 | for root_keyword in root_keywords:
925 | for component in data[root_keyword]:
926 | if "bom-ref" in component:
927 | create_or_update_bom_ref_entry(bom_refs, component)
928 |
929 | detect_nested_bom_refs(component, bom_refs)
930 |
931 | for root_keyword in root_keywords:
932 | for component in data[root_keyword]:
933 | if "dependencies" in component:
934 | for dependency in component["dependencies"]:
935 | if "ref" in dependency:
936 | create_or_update_bom_ref_entry(bom_refs, {"bom-ref": dependency["ref"]})
937 |
938 | if "dependencies" in data:
939 | for dependency in data["dependencies"]:
940 | if "ref" in dependency:
941 | create_or_update_bom_ref_entry(bom_refs, {"bom-ref": dependency["ref"]})
942 |
943 | if "dependsOn" in dependency:
944 | for depends_on in dependency["dependsOn"]:
945 | create_or_update_bom_ref_entry(bom_refs, {"bom-ref": depends_on})
946 |
947 | if "metadata" in data:
948 | if "component" in data["metadata"]:
949 | if "bom-ref" in data["metadata"]["component"]:
950 | if has_bom_ref_components(bom_refs, data["metadata"]["component"]["bom-ref"]):
951 | meta_bom_ref_is_used = True
952 | create_or_update_bom_ref_entry(bom_refs, data["metadata"]["component"])
953 |
954 | return bom_refs, meta_bom_ref_is_used
955 |
956 |
957 | def parse_licenses(component):
958 | licenses = set()
959 | if "licenses" in component:
960 | for license in component["licenses"]:
961 | if "license" in license:
962 | if "id" in license["license"]:
963 | licenses.add(license["license"]["id"])
964 | elif "name" in license["license"]:
965 | licenses.add(license["license"]["name"])
966 | return sorted(list(licenses))
967 |
968 |
969 | def parse_metadata(data):
970 | metadata_info = {}
971 |
972 | metadata_field = None
973 |
974 | if "metadata" in data:
975 | metadata_field = data["metadata"]
976 |
977 | if metadata_field is not None:
978 | if "component" in metadata_field:
979 | metadata_info["Main Component"] = {}
980 | if "type" in metadata_field["component"]:
981 | metadata_info["Main Component"]["Type"] = metadata_field["component"]["type"]
982 | if "group" in metadata_field["component"]:
983 | metadata_info["Main Component"]["Group"] = metadata_field["component"]["group"]
984 | if "name" in metadata_field["component"]:
985 | metadata_info["Main Component"]["Name"] = metadata_field["component"]["name"]
986 | if "version" in metadata_field["component"]:
987 | metadata_info["Main Component"]["Version"] = metadata_field["component"]["version"]
988 | if "description" in metadata_field["component"]:
989 | metadata_info["Main Component"]["Description"] = metadata_field["component"]["description"]
990 | if "purl" in metadata_field["component"]:
991 | metadata_info["Main Component"]["PURL"] = metadata_field["component"]["purl"]
992 |
993 | if "properties" in metadata_field["component"]:
994 | for property_element in metadata_field["component"]["properties"]:
995 | metadata_info["Main Component"][f'{property_element["name"][0].capitalize()}{property_element["name"][1:]}'] = property_element["value"]
996 |
997 | if "specVersion" in data:
998 | metadata_info["Spec Version"] = data["specVersion"]
999 |
1000 | if "serialNumber" in data:
1001 | metadata_info["Serial Number"] = data["serialNumber"]
1002 |
1003 | if "version" in data:
1004 | metadata_info["Version"] = str(data["version"])
1005 |
1006 | if metadata_field is not None:
1007 | if "tools" in metadata_field:
1008 | counter = 0
1009 | for tool in metadata_field["tools"]:
1010 | counter += 1
1011 | info_id = "Tool"
1012 | if len(metadata_field["tools"]) > 1:
1013 | info_id = f"{info_id} #{counter}"
1014 |
1015 | metadata_info[info_id] = {}
1016 | if "vendor" in tool:
1017 | metadata_info[info_id]["Vendor"] = tool["vendor"]
1018 | if "name" in tool:
1019 | metadata_info[info_id]["Name"] = tool["name"]
1020 | if "version" in tool:
1021 | metadata_info[info_id]["Version"] = tool["version"]
1022 | if "services" in tool:
1023 | counter_services = 0
1024 | services = metadata_field["tools"]["services"]
1025 |
1026 | for service in services:
1027 | counter_services += 1
1028 | field_id = "Service"
1029 | if len(services) > 1:
1030 | field_id = f"Service #{counter_services}"
1031 |
1032 | if "vendor" in service:
1033 | metadata_info[info_id][f"{field_id} Vendor"] = service["vendor"]
1034 | if "name" in service:
1035 | metadata_info[info_id][f"{field_id} Name"] = service["name"]
1036 | if "version" in service:
1037 | metadata_info[info_id][f"{field_id} Version"] = service["version"]
1038 |
1039 | return metadata_info
1040 |
1041 |
1042 | def parse_json_data(data):
1043 | all_bom_refs, meta_bom_ref_is_used = get_all_bom_refs(data)
1044 |
1045 | guessed_bom_refs_cache = {}
1046 |
1047 | components = {}
1048 |
1049 | root_keywords = []
1050 | if "components" in data:
1051 | root_keywords.append("components")
1052 | if "services" in data:
1053 | root_keywords.append("services")
1054 |
1055 | if "metadata" in data:
1056 | if "component" in data["metadata"]:
1057 | component = data["metadata"]["component"]
1058 | if meta_bom_ref_is_used is True:
1059 | new_component = create_base_component(component)
1060 | bom_ref = get_bom_ref(component, all_bom_refs)
1061 | components[bom_ref] = new_component
1062 |
1063 | metadata_info = parse_metadata(data)
1064 |
1065 | for root_keyword in root_keywords:
1066 | for component in data[root_keyword]:
1067 | new_component = create_base_component(component)
1068 | bom_ref = get_bom_ref(component, all_bom_refs)
1069 | components[bom_ref] = new_component
1070 | add_nested_components(component, components, all_bom_refs)
1071 |
1072 | # sometimes dependencies are declared inside a component, I'll check that now
1073 | for component in data[root_keyword]:
1074 | bom_ref = get_bom_ref(component, all_bom_refs)
1075 |
1076 | if "dependencies" in component:
1077 | for dependency in component["dependencies"]:
1078 | depends_on = dependency["ref"]
1079 | if depends_on not in components:
1080 | if depends_on in guessed_bom_refs_cache:
1081 | depends_on = guessed_bom_refs_cache[depends_on]
1082 | else:
1083 | custom_print(f"WARNING: 'ref' '{depends_on}' is used in 'dependencies' inside a component but it's not declared in 'components'. I'll search for a match...")
1084 | guessed_bom_ref = normalize_bom_ref(all_bom_refs, depends_on)
1085 | guessed_bom_refs_cache[depends_on] = guessed_bom_ref
1086 |
1087 | if guessed_bom_ref is None:
1088 | custom_print(f"Match not found. I'll create a fake one.")
1089 | components[depends_on] = create_fake_component(depends_on)
1090 | else:
1091 | custom_print(f"Match found: {guessed_bom_ref}")
1092 | depends_on = guessed_bom_ref
1093 |
1094 | components[bom_ref]["depends_on"].add(depends_on)
1095 | components[depends_on]["dependency_of"].add(bom_ref)
1096 |
1097 | # sometimes vulnerabilities are declared inside a component, I'll check that now
1098 | for component in data[root_keyword]:
1099 | bom_ref = get_bom_ref(component, all_bom_refs)
1100 |
1101 | if "vulnerabilities" in component:
1102 | for vulnerability in component["vulnerabilities"]:
1103 | vuln_id, vuln_severity, vuln_score, vuln_vector = parse_vulnerability_data(vulnerability)
1104 |
1105 | vulnerability_data = {"id": vuln_id, "severity": vuln_severity, "score": vuln_score, "vector": vuln_vector}
1106 | if vulnerability_data not in components[bom_ref]["vulnerabilities"]:
1107 | components[bom_ref]["vulnerabilities"].append(vulnerability_data)
1108 | if VALID_SEVERITIES[vuln_severity] > VALID_SEVERITIES[components[bom_ref]["max_vulnerability_severity"]]:
1109 | components[bom_ref]["max_vulnerability_severity"] = vuln_severity
1110 |
1111 | if "dependencies" in data:
1112 | for dependency in data["dependencies"]:
1113 | bom_ref = dependency["ref"]
1114 | if bom_ref not in components:
1115 | if bom_ref in guessed_bom_refs_cache:
1116 | bom_ref = guessed_bom_refs_cache[bom_ref]
1117 | else:
1118 | custom_print(f"WARNING: 'ref' '{bom_ref}' is used in 'dependencies' in a 'ref' field but it's not declared in 'components'. I'll search for a match...")
1119 | guessed_bom_ref = normalize_bom_ref(all_bom_refs, bom_ref)
1120 | guessed_bom_refs_cache[bom_ref] = guessed_bom_ref
1121 | if guessed_bom_ref is None:
1122 | custom_print(f"Match not found. I'll create a fake one.")
1123 | components[bom_ref] = create_fake_component(bom_ref)
1124 | else:
1125 | custom_print(f"Match found: {guessed_bom_ref}")
1126 | bom_ref = guessed_bom_ref
1127 |
1128 | if "dependsOn" in dependency:
1129 | for depends_on in dependency["dependsOn"]:
1130 | if depends_on not in components:
1131 | if depends_on in guessed_bom_refs_cache:
1132 | depends_on = guessed_bom_refs_cache[depends_on]
1133 | else:
1134 | custom_print(f"WARNING: 'dependsOn' '{depends_on}' is used in 'dependencies' in a 'dependsOn' field but it's not declared in 'components'. I'll search for a match...")
1135 | guessed_bom_ref = normalize_bom_ref(all_bom_refs, depends_on)
1136 | guessed_bom_refs_cache[depends_on] = guessed_bom_ref
1137 | if guessed_bom_ref is None:
1138 | custom_print(f"Match not found. I'll create a fake one.")
1139 | components[depends_on] = create_fake_component(depends_on)
1140 | else:
1141 | custom_print(f"Match found: {guessed_bom_ref}")
1142 | depends_on = guessed_bom_ref
1143 |
1144 | components[bom_ref]["depends_on"].add(depends_on)
1145 | components[depends_on]["dependency_of"].add(bom_ref)
1146 |
1147 | if "vulnerabilities" in data:
1148 | for vulnerability in data["vulnerabilities"]:
1149 | vuln_id, vuln_severity, vuln_score, vuln_vector = parse_vulnerability_data(vulnerability)
1150 |
1151 | for affects in vulnerability["affects"]:
1152 | bom_ref = affects["ref"]
1153 | if bom_ref not in components:
1154 | custom_print(f"WARNING: 'ref' '{bom_ref}' is used in 'vulnerabilities' but it's not declared in 'components'. I'll create a fake one.")
1155 | components[bom_ref] = create_fake_component(bom_ref)
1156 |
1157 | vulnerability_data = {"id": vuln_id, "severity": vuln_severity, "score": vuln_score, "vector": vuln_vector}
1158 | if vulnerability_data not in components[bom_ref]["vulnerabilities"]:
1159 | components[bom_ref]["vulnerabilities"].append(vulnerability_data)
1160 | if VALID_SEVERITIES[vuln_severity] > VALID_SEVERITIES[components[bom_ref]["max_vulnerability_severity"]]:
1161 | components[bom_ref]["max_vulnerability_severity"] = vuln_severity
1162 |
1163 | return components, metadata_info
1164 |
1165 |
1166 | def parse_string(input_string):
1167 | custom_print("Parsing input string...")
1168 | data = json.loads(input_string)
1169 | return parse_json_data(data)
1170 |
1171 |
1172 | def parse_file(input_file_path):
1173 | custom_print("Parsing input file...")
1174 | with open(input_file_path, 'r') as file:
1175 | data = json.load(file)
1176 | return parse_json_data(data)
1177 |
1178 |
1179 | def prepare_chart_element_name(component):
1180 | if component["version"] != "-":
1181 | name = f'{html.escape(component["name"])} {html.escape(component["version"])}'
1182 | else:
1183 | name = f'{html.escape(component["name"])}'
1184 |
1185 | if len(component["vulnerabilities"]) > 0:
1186 | name += "
Vulnerabilities: "
1187 |
1188 | vulns = {}
1189 | for vulnerability in component["vulnerabilities"]:
1190 | vulns[f'