Skip to content

Commit c68c444

Browse files
authored
Add support for AI BOM format (#43)
1 parent 78b33c7 commit c68c444

9 files changed

Lines changed: 1869 additions & 27 deletions

README.md

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,30 @@
1010
**sbom-validator** is a Go library designed to validate
1111
**Software Bill of Materials (SBOMs)** against the official
1212
SBOM specifications. It ensures compliance with formats like
13-
**CycloneDX** & **SPDX** and helps maintain software supply chain security.
13+
**CycloneDX**, **SPDX**, and **AI-SBOM** and helps maintain software supply chain security.
1414

1515
## Features
1616

17-
✅ Detects SBOM type (e.g., CycloneDX, SPDX)
17+
✅ Detects SBOM type (e.g., CycloneDX, SPDX, AI-SBOM)
1818

1919
✅ Extracts SBOM version
2020

2121
✅ Validates SBOM against official schemas
2222

2323
✅ Provides detailed validation errors
2424

25+
## Supported Formats
26+
27+
- CycloneDX JSON schemas: 1.2, 1.3, 1.4, 1.5, 1.6, 1.7
28+
- SPDX JSON schemas: 2.2, 2.3
29+
- AI-SBOM JSON schema: 1.0.0
30+
31+
The AI-SBOM schema is embedded from the immutable schema URL:
32+
33+
```text
34+
https://shiftleftcyber.io/ai-bom/schemas/ai-sbom-1.0.0.schema.json
35+
```
36+
2537
## Installation
2638

2739
Use `go get` to install the package:
@@ -55,6 +67,8 @@ suffix should remain on the `v1` line until they are ready to migrate.
5567
package main
5668

5769
import (
70+
"encoding/json"
71+
"flag"
5872
"fmt"
5973
"log"
6074
"os"
@@ -82,24 +96,24 @@ func main() {
8296
}
8397

8498
result, err := sbomvalidator.ValidateSBOMData(jsonData)
85-
if err != nil {
86-
log.Fatalf("Error during validation - %v", err)
87-
}
99+
if err != nil {
100+
log.Fatalf("Error during validation - %v", err)
101+
}
88102

89103
if result.IsValid {
90-
output, _ := json.MarshalIndent(result, "", " ")
91-
fmt.Println(string(output))
92-
} else {
93-
fmt.Printf("Validation failed! Showing up to %d errors:\n", 10)
94-
95-
for i, errMsg := range result.ValidationErrors {
96-
if i >= 10 {
97-
fmt.Printf("...and %d more errors.\n", len(result.ValidationErrors)-10)
98-
break
99-
}
100-
fmt.Printf("- %s\n", errMsg)
101-
}
102-
}
104+
output, _ := json.MarshalIndent(result, "", " ")
105+
fmt.Println(string(output))
106+
} else {
107+
fmt.Printf("Validation failed! Showing up to %d errors:\n", 10)
108+
109+
for i, errMsg := range result.ValidationErrors {
110+
if i >= 10 {
111+
fmt.Printf("...and %d more errors.\n", len(result.ValidationErrors)-10)
112+
break
113+
}
114+
fmt.Printf("- %s\n", errMsg)
115+
}
116+
}
103117
}
104118
```
105119

@@ -139,8 +153,24 @@ DEBUG: 2026/04/07 14:00:00 CycloneDX version is set to: 1.6
139153
"sbomVersion": "1.6",
140154
"detectedFormat": "JSON"
141155
}
156+
157+
./bin/sbom-validator-example -file sample-sboms/customer-support-ai-sbom.json
158+
{
159+
"isValid": true,
160+
"sbomType": "AI-SBOM",
161+
"sbomVersion": "1.0.0",
162+
"detectedFormat": "JSON"
163+
}
142164
```
143165

166+
AI-SBOM examples are included under `sample-sboms/`:
167+
168+
- `customer-support-ai-sbom.json`
169+
- `medical-triage-ai-sbom.json`
170+
- `missing-required-metadata.json`
171+
- `bad-types-and-enums-ai-sbom.json`
172+
- `unknown-extra-properties-ai-sbom.json`
173+
144174
## License
145175

146176
This project is licensed under the MIT License.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"schemaVersion": "1.0.0",
3+
"metadata": {
4+
"bomFormat": "AI-SBOM",
5+
"sbomAuthor": "Example Author",
6+
"sbomVersion": "1.0.0",
7+
"sbomDataFormatName": "AI SBOM JSON",
8+
"sbomDataFormatVersion": "1.0.0",
9+
"sbomAuthorSignature": {
10+
"algorithm": "ecdsa-p256-sha256",
11+
"value": "signature"
12+
},
13+
"sbomToolName": "Example Tool",
14+
"sbomToolVersion": "1.0.0",
15+
"sbomGenerationContext": "during-lunch",
16+
"sbomTimestamp": "not a timestamp",
17+
"sbomDependencyRelationships": []
18+
},
19+
"system": {
20+
"systemName": "Example System",
21+
"systemComponents": [],
22+
"systemProducer": "Example Producer",
23+
"systemVersion": 2,
24+
"systemTimestamp": "2026-05-18T14:22:31Z",
25+
"systemDataFlow": [],
26+
"systemDataUsage": "Example usage.",
27+
"systemInputOutputProperties": {
28+
"inputModalities": [],
29+
"outputModalities": [
30+
"text"
31+
],
32+
"inputPreprocessing": "none"
33+
},
34+
"intendedApplicationArea": []
35+
},
36+
"models": [],
37+
"datasets": [],
38+
"infrastructure": {
39+
"infrastructureSoftware": [],
40+
"infrastructureHardware": {
41+
"hbomUrl": "https://example.com/hbom",
42+
"description": "Example HBOM."
43+
}
44+
},
45+
"security": {
46+
"securityControls": [],
47+
"securityCompliance": [],
48+
"cybersecurityPolicyInformation": "https://example.com/security.txt",
49+
"vulnerabilityReferencing": []
50+
},
51+
"kpis": {
52+
"securityMetrics": [],
53+
"operationalPerformanceKpis": []
54+
}
55+
}

0 commit comments

Comments
 (0)