add bom descriptor schema + test against xml schemas in pipeline (#163)

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2020-08-27 19:12:45 -04:00
committed by GitHub
parent d85d0ac418
commit eda0f8c774
16 changed files with 4081 additions and 28 deletions
+2
View File
@@ -13,6 +13,7 @@ import (
type Document struct {
XMLName xml.Name `xml:"bom"`
XMLNs string `xml:"xmlns,attr"`
XMLNsBd string `xml:"xmlns:bd,attr"`
Version int `xml:"version,attr"`
SerialNumber string `xml:"serialNumber,attr"`
Components []Component `xml:"components>component"` // The BOM contents
@@ -23,6 +24,7 @@ type Document struct {
func NewDocument() Document {
return Document{
XMLNs: "http://cyclonedx.org/schema/bom/1.2",
XMLNsBd: "http://cyclonedx.org/schema/ext/bom-descriptor/1.0",
Version: 1,
SerialNumber: uuid.New().URN(),
}
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" version="1" serialNumber="urn:uuid:1519f630-0721-40f5-8462-277e6534761d">
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" xmlns:bd="http://cyclonedx.org/schema/ext/bom-descriptor/1.0" version="1" serialNumber="urn:uuid:0667955f-34d0-49c1-8062-996dbc636974">
<components>
<component type="library">
<name>package-1</name>
@@ -19,7 +19,7 @@
</component>
</components>
<bd:metadata>
<bd:timestamp>2020-08-24T17:37:37-04:00</bd:timestamp>
<bd:timestamp>2020-08-26T15:31:39-04:00</bd:timestamp>
<bd:tool>
<bd:vendor>anchore</bd:vendor>
<bd:name>syft</bd:name>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" version="1" serialNumber="urn:uuid:4448d650-a65e-49e4-b826-30d2010dfcd9">
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" xmlns:bd="http://cyclonedx.org/schema/ext/bom-descriptor/1.0" version="1" serialNumber="urn:uuid:2e7af7d0-83a4-4730-9175-66858406b285">
<components>
<component type="library">
<name>package-1</name>
@@ -19,7 +19,7 @@
</component>
</components>
<bd:metadata>
<bd:timestamp>2020-08-24T17:37:37-04:00</bd:timestamp>
<bd:timestamp>2020-08-26T15:31:39-04:00</bd:timestamp>
<bd:tool>
<bd:vendor>anchore</bd:vendor>
<bd:name>syft</bd:name>