Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ntia compliance report #286

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 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
18 changes: 18 additions & 0 deletions Compliance.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,21 @@ The [OpenChain Telco](https://github.com/OpenChain-Project/Reference-Material/bl
| Timing of SBOM delivery | 3.6 | `SBOM delivery time` | delivery time | |
| Method of SBOM delivery | 3.7 | `SBOM delivery method` | delivery method | |
| SBOM Scope | 3.8 | `SBOM scope` | sbom scope | |

## NTIA minimum elements: SBOM Requirements for NTIA
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also denotes field which are mandatory vs optional with an *

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


The [NTIA](https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publications/TechGuidelines/TR03183/BSI-TR-03183-2.pdf) specifies mandatory properties for an SBOM. Below is how we have derived all the values.

| NTIA minimum elements | Section ID | NTIA Fields | CycloneDX |SPDX(2.3) | Notes |
| :--- | :--- |:--- | :--- | :--- | :--- |
| Automation Support | 1.1 | `Machine Readable Format` | BomFormat & data forrmat | SPDXversion & data forrmat | |
| SBOM Data Fields | 2.1 | `Author of the SBOM` | metadata->authors, metadata->supplier | creator | |
Copy link
Contributor

Choose a reason for hiding this comment

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

For SPDX it should be creator->Person, creator->organization or creator->tool

| | 2.2 | `Timestamp` | metadata->timestamp | created | |
| | 2.3 | `present` | | | all package elements |
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this

| Package Data Fields | 2.4 | `Package Name` | component->name | package->name | |
| | 2.5 | `Dependency Relationship` | dependencies, composition | relationships | |
Copy link
Contributor

Choose a reason for hiding this comment

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

Just dependencies here, composition is for depth.

| | 2.6 | `Supplier Name` | component->supplier | packageSupplier, packageOriginator | |
| | 2.7 | `Version of Component` | component->version | package->version | |
| | 2.8 | `Other Uniq IDs` | component->cpe, component->purl | DocumentNamespace, SPDXID | |
Copy link
Contributor

Choose a reason for hiding this comment

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

For SPDX it should also be cpe/purl

| Practices and Processes | 3.1 | `Depth` | dependencies, compositions | relationships | |
| | 3.2 | `Known Unknowns` | | | |
3 changes: 2 additions & 1 deletion cmd/compliance.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func setupEngineParams(cmd *cobra.Command, args []string) *engine.Params {
engParams.Detailed, _ = cmd.Flags().GetBool("detailed")
engParams.JSON, _ = cmd.Flags().GetBool("json")

engParams.Ntia, _ = cmd.Flags().GetBool("ntia")
// engParams.Ntia, _ = cmd.Flags().GetBool("ntia")
engParams.Bsi, _ = cmd.Flags().GetBool("bsi")
engParams.Oct, _ = cmd.Flags().GetBool("oct")
Expand All @@ -96,7 +97,7 @@ func init() {
complianceCmd.MarkFlagsMutuallyExclusive("json", "basic", "detailed")

// Standards control
// complianceCmd.Flags().BoolP("ntia", "n", false, "check for NTIA minimum elements compliance")
complianceCmd.Flags().BoolP("ntia", "n", false, "check for NTIA minimum elements compliance")
complianceCmd.Flags().BoolP("bsi", "c", false, "BSI TR-03183-2 v1.1 compliance")
// complianceCmd.MarkFlagsMutuallyExclusive("ntia", "cra")
complianceCmd.Flags().BoolP("oct", "t", false, "OpenChainTelco compliance")
Expand Down
8 changes: 4 additions & 4 deletions pkg/compliance/bsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ func bsiCreator(doc sbom.Document) *record {
score := 0.0

for _, author := range doc.Authors() {
if author.Email() != "" {
result = author.Email()
if author.GetEmail() != "" {
result = author.GetEmail()
score = 10.0
break
}
Expand Down Expand Up @@ -399,7 +399,7 @@ func bsiComponentOtherUniqIDs(component sbom.GetComponent) *record {
result := ""
score := 0.0

purl := component.Purls()
purl := component.GetPurls()

if len(purl) > 0 {
result = string(purl[0])
Expand All @@ -408,7 +408,7 @@ func bsiComponentOtherUniqIDs(component sbom.GetComponent) *record {
return newRecordStmtOptional(COMP_OTHER_UNIQ_IDS, component.GetID(), result, score)
}

cpes := component.Cpes()
cpes := component.GetCpes()

if len(cpes) > 0 {
result = string(cpes[0])
Expand Down
Loading