github.com/devseccon/trivy@v0.47.1-0.20231123133102-bd902a0bd996/pkg/fanal/types/sbom.go (about) 1 package types 2 3 // CycloneDX re-defines only necessary fields from cyclondx/cyclonedx-go 4 // cf. https://github.com/CycloneDX/cyclonedx-go/blob/de6bc07025d148badc8f6699ccb556744a5f4070/cyclonedx.go#L58-L77 5 // 6 // The encoding/xml package that cyclondx-go depends on cannot be imported due to some limitations in TinyGo. 7 // cf. https://tinygo.org/docs/reference/lang-support/stdlib/ 8 type CycloneDX struct { 9 // JSON specific fields 10 BOMFormat string `json:"bomFormat" xml:"-"` 11 SpecVersion SpecVersion `json:"specVersion" xml:"-"` 12 13 SerialNumber string `json:"serialNumber,omitempty" xml:"serialNumber,attr,omitempty"` 14 Version int `json:"version" xml:"version,attr"` 15 Metadata Metadata `json:"metadata,omitempty" xml:"metadata,omitempty"` 16 Components []Component `json:"components,omitempty" xml:"components>component,omitempty"` 17 } 18 19 type Metadata struct { 20 Timestamp string `json:"timestamp,omitempty" xml:"timestamp,omitempty"` 21 Component Component `json:"component,omitempty" xml:"component,omitempty"` 22 } 23 24 type Component struct { 25 BOMRef string `json:"bom-ref,omitempty" xml:"bom-ref,attr,omitempty"` 26 MIMEType string `json:"mime-type,omitempty" xml:"mime-type,attr,omitempty"` 27 Type ComponentType `json:"type" xml:"type,attr"` 28 Name string `json:"name" xml:"name"` 29 Version string `json:"version,omitempty" xml:"version,omitempty"` 30 PackageURL string `json:"purl,omitempty" xml:"purl,omitempty"` 31 } 32 33 type ( 34 ComponentType string 35 SpecVersion int 36 )