Skip to content

Commit

Permalink
Bom-diff missing elements and statistics bugfixes (#32)
Browse files Browse the repository at this point in the history
* Bugfix for bom-diff missing elements in output.

Signed-off-by: Caroline Russell <[email protected]>

* Improve bom-diff html report.

Signed-off-by: Caroline Russell <[email protected]>

---------

Signed-off-by: Caroline Russell <[email protected]>
  • Loading branch information
cerrussell authored Aug 12, 2024
1 parent 948534e commit cfdb91b
Show file tree
Hide file tree
Showing 6 changed files with 400 additions and 51 deletions.
208 changes: 202 additions & 6 deletions custom_json_diff/bom_diff_template.j2
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<th style="text-align: center; width: 46%">{{ bom_1 }}</th>
<th style="text-align: center; width: 46%">{{ bom_2 }}</th>
</tr>
{% if diff_status == 0 %}
{% if diff_status <= 2 %}
<tr>
<td colspan="3" style="text-align: center">No differences found.</td>
</tr>
Expand Down Expand Up @@ -394,8 +394,106 @@
<summary>{{ item['bom-ref'] }}</summary>
<ul>
{% for key, value in item|items %}
{% if value != "" %}
<li>{{ key }}: {{ value }}</li>
{% if value and key not in ["advisories","analysis","cwes","properties"] %}
{% if key == "source" %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for skey, svalue in value|items %}
<li>{{ skey }}: {{ svalue }}</li>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% if key == "ratings" %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for rating in value %}
<li>
<details>
<summary>{{ rating["vector"] }}:</summary>
<ul>
{% for rkey, rvalue in rating|items %}
<li>{{ rkey }}: {{ rvalue }}</li>
{% endfor %}
</ul>
</details>
</li>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% if key == "references" %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for ref in value %}
<details>
<summary>{{ ref['id'] }}:</summary>
<ul>
<li>
name: {{ ref['source']['name'] }}</li>
<li>
url: {{ ref['source']['url'] }}</li>
</ul>
</details>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% if key == "affects" %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for affect in value %}
<details>
<summary>{{ affect['ref'] }}:</summary>
<ul>
{% for a in affect['versions'] %}
<li>{{ a }}</li>
{% endfor %}
</ul>
</details>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% if key not in ["source","ratings","references","affects"] %}
<li>{{ key }}: {{ value }}</li>
{% endif %}
{% endif %}
{% if key in ["advisories","cwes","properties"] and value|length > 0 %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for i in value %}
<li>{{ i }}</li>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% if key == "analysis" and value|length > 0 %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for a,b in value|items %}
<li>{{ a }}: {{ b }}</li>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% endfor %}
</ul>
Expand All @@ -406,8 +504,106 @@
<summary>{{ item['bom-ref'] }}</summary>
<ul>
{% for key, value in item|items %}
{% if value != "" %}
<li>{{ key }}: {{ value }}</li>
{% if value and key not in ["advisories","analysis","cwes","properties"] %}
{% if key == "source" %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for skey, svalue in value|items %}
<li>{{ skey }}: {{ svalue }}</li>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% if key == "ratings" %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for rating in value %}
<li>
<details>
<summary>{{ rating["vector"] }}:</summary>
<ul>
{% for rkey, rvalue in rating|items %}
<li>{{ rkey }}: {{ rvalue }}</li>
{% endfor %}
</ul>
</details>
</li>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% if key == "references" %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for ref in value %}
<details>
<summary>{{ ref['id'] }}:</summary>
<ul>
<li>
name: {{ ref['source']['name'] }}</li>
<li>
url: {{ ref['source']['url'] }}</li>
</ul>
</details>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% if key == "affects" %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for affect in value %}
<details>
<summary>{{ affect['ref'] }}:</summary>
<ul>
{% for a in affect['versions'] %}
<li>{{ a }}</li>
{% endfor %}
</ul>
</details>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% if key not in ["source","ratings","references","affects"] %}
<li>{{ key }}: {{ value }}</li>
{% endif %}
{% endif %}
{% if key in ["advisories","cwes","properties"] and value|length > 0 %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for i in value %}
<li>{{ i }}</li>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% if key == "analysis" and value|length > 0 %}
<li>
<details>
<summary>{{ key }}:</summary>
<ul>
{% for a,b in value|items %}
<li>{{ a }}: {{ b }}</li>
{% endfor %}
</ul>
</details>
</li>
{% endif %}
{% endfor %}
</ul>
Expand Down Expand Up @@ -622,4 +818,4 @@
</div>
<br>
</body>
</html>
</html>
Loading

0 comments on commit cfdb91b

Please sign in to comment.