Skip to content

Commit

Permalink
Adapt test samples to ensure consistency between the different formats
Browse files Browse the repository at this point in the history
Signed-off-by: andreas hilti <69210561+andreas-hilti@users.noreply.github.com>
  • Loading branch information
andreas-hilti committed Aug 31, 2024
1 parent bfb6f8b commit 7e87029
Show file tree
Hide file tree
Showing 42 changed files with 403 additions and 173 deletions.
7 changes: 7 additions & 0 deletions tools/src/test/resources/1.6/valid-annotation-1.6.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
"name": "Partner Org",
"url": [
"https://partner.org"
],
"contact" : [
{
"name": "Support",
"email": "support@partner",
"phone": "800-555-1212"
}
]
},
"group": "org.partner",
Expand Down
18 changes: 9 additions & 9 deletions tools/src/test/resources/1.6/valid-annotation-1.6.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ annotations {
}
}
timestamp {
seconds: 3173618478
nanos: 3
seconds: 1640995200
nanos: 0
}
text: "This is a sample annotation made by an organization"
}
Expand All @@ -40,10 +40,10 @@ annotations {
}
}
timestamp {
seconds: 3173618478
nanos: 3
seconds: 1640995200
nanos: 0
}
text: "This is a sample annotation made by an person"
text: "This is a sample annotation made by a person"
}
annotations {
bom_ref: "annotation-3"
Expand All @@ -56,8 +56,8 @@ annotations {
}
}
timestamp {
seconds: 3173618478
nanos: 3
seconds: 1640995200
nanos: 0
}
text: "This is a sample annotation made by a component"
}
Expand Down Expand Up @@ -90,8 +90,8 @@ annotations {
}
}
timestamp {
seconds: 3173618478
nanos: 3
seconds: 1640995200
nanos: 0
}
text: "This is a sample annotation made by a service"
}
12 changes: 6 additions & 6 deletions tools/src/test/resources/1.6/valid-annotation-1.6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</contact>
</organization>
</annotator>
<timestamp>2020-04-07T07:01:00Z</timestamp>
<timestamp>2022-01-01T00:00:00Z</timestamp>
<text>This is a sample annotation made by an organization</text>
</annotation>
<annotation bom-ref="annotation-2">
Expand All @@ -35,8 +35,8 @@
<phone>800-555-1212</phone>
</individual>
</annotator>
<timestamp>2020-04-07T07:01:00Z</timestamp>
<text>This is a sample annotation made by an person</text>
<timestamp>2022-01-01T00:00:00Z</timestamp>
<text>This is a sample annotation made by a person</text>
</annotation>
<annotation bom-ref="annotation-3">
<subjects>
Expand All @@ -48,7 +48,7 @@
<version>9.1.2</version>
</component>
</annotator>
<timestamp>2020-04-07T07:01:00Z</timestamp>
<timestamp>2022-01-01T00:00:00Z</timestamp>
<text>This is a sample annotation made by a component</text>
</annotation>
<annotation bom-ref="annotation-4">
Expand Down Expand Up @@ -76,11 +76,11 @@
<authenticated>true</authenticated>
<x-trust-boundary>true</x-trust-boundary>
<data>
<classification flow="bi-directional">pubic</classification>
<classification flow="bi-directional">public</classification>
</data>
</service>
</annotator>
<timestamp>2020-04-07T07:01:00Z</timestamp>
<timestamp>2022-01-01T00:00:00Z</timestamp>
<text>This is a sample annotation made by a service</text>
</annotation>
</annotations>
Expand Down
12 changes: 6 additions & 6 deletions tools/src/test/resources/1.6/valid-attestation-1.6.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ declarations: {
}
]
created {
seconds: 1714003200
seconds: 1682380800
nanos: 0
}
expires {
seconds: 1712102400
seconds: 1684972800
nanos: 0
}
author: {
Expand Down Expand Up @@ -104,11 +104,11 @@ declarations: {
}
]
created {
seconds: 1714003200
seconds: 1682380800
nanos: 0
}
expires {
seconds: 1712102400
seconds: 1684972800
nanos: 0
}
author: {
Expand Down Expand Up @@ -136,11 +136,11 @@ declarations: {
}
]
created {
seconds: 1714003200
seconds: 1682380800
nanos: 0
}
expires {
seconds: 1712102400
seconds: 1684972800
nanos: 0
}
author: {
Expand Down
8 changes: 4 additions & 4 deletions tools/src/test/resources/1.6/valid-attestation-1.6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<declarations>
<assessors>
<assessor bom-ref="assessor-1">
<thirdParty>false</thirdParty>
<thirdParty>true</thirdParty>
<organization>
<name>Acme Inc</name>
<name>Assessors Inc</name>
</organization>
</assessor>
</assessors>
Expand All @@ -25,7 +25,7 @@
<score>0.8</score>
<rationale>Conformance rationale here</rationale>
<mitigationStrategies>
<mitigationStrategy>mitigations-1</mitigationStrategy>
<mitigationStrategy>mitigationStrategy-1</mitigationStrategy>
</mitigationStrategies>
</conformance>
<confidence>
Expand Down Expand Up @@ -110,7 +110,7 @@
<contents>
<attachment content-type="text/plain">Mitigation strategy here</attachment>
</contents>
<classification>Public</classification>
<classification>Company Confidential</classification>
<sensitiveData>Describe sensitive data here</sensitiveData>
</data>
<created>2023-04-25T00:00:00+00:00</created>
Expand Down
17 changes: 8 additions & 9 deletions tools/src/test/resources/1.6/valid-bom-1.6.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ version: 1
serial_number: "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79"
metadata {
timestamp {
seconds: 3173618478
nanos: 3
seconds: 1586809239
nanos: 0
}
tools {
vendor: "Awesome Vendor"
Expand Down Expand Up @@ -112,15 +112,15 @@ components {
version: "9.0.14"
}
commits {
uid: "123"
url: ""
uid: "7638417db6d59f3c431d3e1f261cc637155684cd"
url: "https://location/to/7638417db6d59f3c431d3e1f261cc637155684cd"
author {
timestamp {
seconds: 3084280878
nanos: 3
seconds: 1542140439
nanos: 0
}
name: ""
email: ""
name: "me"
email: "me@acme.org"
}
}
}
Expand All @@ -141,7 +141,6 @@ components {
email: "support@apac.example.com"
}
}
author: "Example Super Heros"
group: "org.example"
name: "mylibrary"
version: "1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ serial_number: "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79"
components {
type: CLASSIFICATION_LIBRARY
group: "com.example"
name: "acme-example"
name: "acme-library"
version: "1.0.0"
cpe: "cpe:2.3:a:example:acme-library:1.0.0:*:*:*:*:*:*:*"
purl: "pkg:maven/com.example/acme-library@1.0.0"
Expand Down
12 changes: 10 additions & 2 deletions tools/src/test/resources/1.6/valid-component-ref-1.6.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@
"type": "library",
"bom-ref": "123",
"name": "acme-library",
"version": "1.0.0"
"version": "1.0.0",
"components" : [
{
"type": "library",
"bom-ref": "456",
"name": "acme-library",
"version": "1.0.0"
}
]
},
{
"type": "library",
"bom-ref": "456",
"bom-ref": "789",
"name": "acme-library",
"version": "1.0.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ components {
bom_ref: "123"
name: "acme-library"
version: "1.0.0"
components {
type: CLASSIFICATION_LIBRARY
bom_ref: "456"
name: "acme-library"
version: "1.0.0"
}
}
components {
type: CLASSIFICATION_LIBRARY
bom_ref: "456"
bom_ref: "789"
name: "acme-library"
version: "1.0.0"
}
8 changes: 4 additions & 4 deletions tools/src/test/resources/1.6/valid-compositions-1.6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</component>
<component type="library" bom-ref="pkg:maven/acme/library@3.0">
<name>Acme Library</name>
<version>2.0</version>
<version>3.0</version>
<purl>pkg:maven/acme/library@3.0</purl>
</component>
</components>
Expand Down Expand Up @@ -49,9 +49,9 @@
</composition>
<composition>
<aggregate>incomplete_first_party_only</aggregate>
<assemblies>
<assembly ref="vulnerability-1"/>
</assemblies>
<vulnerabilities>
<vulnerability ref="vulnerability-1"/>
</vulnerabilities>
</composition>
</compositions>
<vulnerabilities>
Expand Down
24 changes: 12 additions & 12 deletions tools/src/test/resources/1.6/valid-cryptography-full-1.6.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ components: [
subjectName: "Subject name here"
issuerName: "Issuer name here"
notValidBefore {
seconds: 3173618478
nanos: 3
seconds: 1640995200
nanos: 0
}
notValidAfter {
seconds: 3173618478
nanos: 3
seconds: 1704067200
nanos: 0
}
signatureAlgorithmRef: "bom-ref-to-algorithm"
subjectPublicKeyRef: "bom-ref-to-public-key"
Expand Down Expand Up @@ -93,20 +93,20 @@ components: [
state: CRYPTO_RELATED_STATE_ACTIVE
algorithmRef: "bom-ref-to-algorithm"
creationDate {
seconds: 3173618478
nanos: 3
seconds: 1704067200
nanos: 0
}
activationDate {
seconds: 3173618478
nanos: 3
seconds: 1704153600
nanos: 0
}
updateDate {
seconds: 3173618478
nanos: 3
seconds: 1704240000
nanos: 0
}
expirationDate {
seconds: 3173618478
nanos: 3
seconds: 1704326400
nanos: 0
}
value: "Value here"
size: 1024
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
</cryptoProperties>
</component>
<component type="library" bom-ref="crypto-library">
<name>Crypto Library</name>
<name>Crypto library</name>
<version>1.0.0</version>
</component>
<component type="library" bom-ref="some-library">
<name>Some Library</name>
<name>Some library</name>
<version>1.0.0</version>
</component>
</components>
Expand Down
6 changes: 3 additions & 3 deletions tools/src/test/resources/1.6/valid-dependency-1.6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.6">
<components>
<component type="library" bom-ref="library-a">
<name>acme-library-a</name>
<name>library-a</name>
<version>1.0.0</version>
</component>
<component type="library" bom-ref="library-b">
<name>acme-library-b</name>
<name>library-b</name>
<version>1.0.0</version>
</component>
<component type="library" bom-ref="library-c">
<name>acme-library-b</name>
<name>library-c</name>
<version>1.0.0</version>
</component>
</components>
Expand Down
1 change: 0 additions & 1 deletion tools/src/test/resources/1.6/valid-evidence-1.6.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ components [
}
],
tools: [
"bom-ref-of-tool-that-performed-analysis",
"bom-ref-of-tool-that-performed-analysis"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.6">
<components>
<component type="library">
<publisher>Acme Inc</publisher>
<group>org.example</group>
<name>mylibrary</name>
<version>1.0.0</version>
Expand All @@ -14,7 +15,7 @@
<url>https://example.org/support/sbom/portal-server/1.0.0</url>
<comment>An external SBOM that describes what this component includes</comment>
<hashes>
<hash alg="SHA-256">f498a8ff2dd007e29c2074f5e4b01a9a01775c3ff3aeaf6906ea503bc5791b7b</hash>
<hash alg="SHA-256">708f1f53b41f11f02d12a11b1a38d2905d47b099afc71a0f1124ef8582ec7313</hash>
</hashes>
</reference>
<reference type="documentation">
Expand Down
Loading

0 comments on commit 7e87029

Please sign in to comment.