Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions docs/adrs/00007-sbom-dashbord.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# 00007. Sbom dashboard.

Date: 2025-04-27

## Status

DRAFT

## Context
This ADR document is intended to define and implement the backend logic for the heard of SBOM dashboard in the UI.

Its mockup design document is as follows.
![header-dashbord.png](sbom-dashboard/header-dashbord.png)
### This dashboard's header can be divided into three parts:
- sbom state
![sbom-status.png](sbom-dashboard/sbom-status.png)
The information includes two components: the total sum of the Packages and the total sum of individual licenses (with Policy Violations removed).
- Vulnerabilities state
![v11y-state.png](sbom-dashboard/v11y-state.png)
It also contains the total number of Vulnerabilities, as well as the count for each severity level.
- License info
![license-state.png](sbom-dashboard%2Flicense-state.png)
It consists of two parts:
- SBOM information (name, version, published date).
- License grouping - aggregating all unique licenses and visualizing them in a pie chart.

## Decision
### Why is it divided into three endpoints?
Because these three features each require substantial computation, combining them into a single endpoint would result in excessively long page response times and negatively impact the user experience.

### Design an endpoint for each of these parts.
- sbom state
- **HTTP GET api/v2/sbom/{id}/sbom-status**
- Reponse playload
```json
{
"total_packages": "0",
"total_licenses": "0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that information make more sense in the license state endpoint?

}
```
- **total_packages** indicates the number of packages contained in the SBOM, which can be obtained from the sbom_package model.
- **total_licenses** indicates the number of distinct license IDs contained in the SBOM, including only standard SPDX IDs. This value can be obtained by counting the spdx_licenses field in the license model.
- Vulnerabilities state
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for having three "state" endpoints? Wouldn't it be simpler to have one?

- **HTTP GET api/v2/sbom/{id}/vulnerabilities-status**
- - Reponse playload
```json
{
"total_vulnerabilities": "0",
"total_none": "0",
"total_critical": "0",
"total_high": "0",
"total_medium": "0",
"total_low": "0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about "none"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‘none’ is just 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my understanding none is a dedicated severity. So there can 5 vulnerabilities of type none.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right.

}
```
- **total_vulnerabilities** represents the total number of vulnerabilities across all packages in the SBOM. You can calculate this by retrieving each package’s purl, fetching its PurlAdvisory via PurlDetails, then obtaining the PurlStatus from that advisory, and finally counting all vulnerabilities and grouping them by severity level.


- license state
- **HTTP GET api/v2/sbom/{id}/license-status*
- Reponse playload
```json
{
"name": "Sbom-name",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have additional SBOM information (name, version, …) here. But not in the others?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These all came from the mockup, and I also think they’re not very reasonable; we could consider removing them.

"version": "0",
"published_date": "",
"licenses": [
{ "name:": "Apache-2.0", "count": "10"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my understanding some SPDX licenses are actually license expressions. How do we handle those?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have spdx_licenses to store the standard SPDX IDs parsed from license expressions.

Copy link
Contributor

@ctron ctron May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but what's then the meaning of an entry of e.g. MIT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indicates how many times the MIT license appears.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So MIT OR LGPL-2.1-only would show up as MIT and LGPL-2.1-only? That feels wrong.

Copy link
Contributor Author

@bxf12315 bxf12315 May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purely from the perspective of occurrence counts, this does not involve the semantics of specific SPDX expressions and should be fine. Only when dealing with actual license relationships might issues occur.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what the benefit of the user having this?

{ "name:": "MIT", "count": "10"},
...
]
}
```
- **licenses** represents all license IDs appearing in this SBOM (custom licenses are collectively labeled as “other”), and counts their occurrences.
Binary file added docs/adrs/sbom-dashboard/header-dashbord.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/adrs/sbom-dashboard/license-state.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/adrs/sbom-dashboard/sbom-status.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/adrs/sbom-dashboard/v11y-state.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.