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

deps: update dependency org.cyclonedx:cyclonedx-core-java to v8 #7613

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ asciidoctorjPdf = "2.3.9"
clikt = "4.2.1"
commonsCompress = "1.24.0"
cvssCalculator = "1.4.2"
cyclonedx = "7.3.2"
cyclonedx = "8.0.1"
diffUtils = "4.12"
diskLruCache = "2.0.2"
exposed = "0.44.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.4",
"specVersion": "1.5",
"serialNumber": "urn:uuid:01234567-0123-0123-0123-01234567",
"version": 1,
"metadata": {
"timestamp": "1970-01-01T00:00:00Z",
"tools": [
{
"name": "OSS Review Toolkit",
"version": "deadbeef"
}
],
"tools": {
"components": [
{
"name": "OSS Review Toolkit",
"version": "deadbeef",
"type": "application"
}
]
},
"licenses": [
{
"expression": "CC0-1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.4",
"specVersion": "1.5",
"serialNumber": "urn:uuid:01234567-0123-0123-0123-01234567",
"version": 1,
"metadata": {
"timestamp": "1970-01-01T00:00:00Z",
"tools": [
{
"name": "OSS Review Toolkit",
"version": "deadbeef"
}
],
"tools": {
"components": [
{
"name": "OSS Review Toolkit",
"version": "deadbeef",
"type": "application"
}
]
},
"licenses": [
{
"expression": "CC0-1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.4",
"specVersion": "1.5",
"serialNumber": "urn:uuid:01234567-0123-0123-0123-01234567",
"version": 1,
"metadata": {
"timestamp": "1970-01-01T00:00:00Z",
"tools": [
{
"name": "OSS Review Toolkit",
"version": "deadbeef"
}
],
"tools": {
"components": [
{
"name": "OSS Review Toolkit",
"version": "deadbeef",
"type": "application"
}
]
},
"licenses": [
{
"expression": "CC0-1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<bom serialNumber="urn:uuid:01234567-0123-0123-0123-01234567" version="1" xmlns="http://cyclonedx.org/schema/bom/1.4">
<bom serialNumber="urn:uuid:01234567-0123-0123-0123-01234567" version="1" xmlns="http://cyclonedx.org/schema/bom/1.5">
<metadata>
<timestamp>1970-01-01T00:00:00Z</timestamp>
<tools>
<tool>
<name>OSS Review Toolkit</name>
<version>deadbeef</version>
</tool>
<components>
<component type="application">
<name>OSS Review Toolkit</name>
<version>deadbeef</version>
</component>
</components>
</tools>
<licenses>
<expression>CC0-1.0</expression>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,14 @@ class CycloneDxReporterFunTest : WordSpec({
}
})

private fun String.patchCycloneDxResult(): String {
val headerEnd = indexOf("components").takeUnless { it < 0 } ?: length
return substring(0, headerEnd)
.replaceFirst(
"""urn:uuid:[a-f0-9]{8}(?:-[a-f0-9]{4}){4}[a-f0-9]{8}""".toRegex(),
"urn:uuid:01234567-0123-0123-0123-01234567"
)
.replaceFirst(
"""(timestamp[>"](\s*:\s*")?)\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z""".toRegex(),
"$11970-01-01T00:00:00Z"
)
.replaceFirst(
"""(version[>"](\s*:\s*")?)[\w.+-]+""".toRegex(),
"$1deadbeef"
) + substring(headerEnd)
}
private fun String.patchCycloneDxResult(): String =
replaceFirst(
"""urn:uuid:[a-f0-9]{8}(?:-[a-f0-9]{4}){4}[a-f0-9]{8}""".toRegex(),
"urn:uuid:01234567-0123-0123-0123-01234567"
).replaceFirst(
"""(timestamp[>"](\s*:\s*")?)\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z""".toRegex(),
"$11970-01-01T00:00:00Z"
).replaceFirst(
"""(version[>"](\s*:\s*")?)[\w.+-]+""".toRegex(),
"$1deadbeef"
)
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import org.cyclonedx.model.Hash
import org.cyclonedx.model.License
import org.cyclonedx.model.LicenseChoice
import org.cyclonedx.model.Metadata
import org.cyclonedx.model.Tool
import org.cyclonedx.model.metadata.ToolInformation

import org.ossreviewtoolkit.model.FileFormat
import org.ossreviewtoolkit.model.LicenseSource
Expand Down Expand Up @@ -66,7 +66,7 @@ import org.ossreviewtoolkit.utils.spdx.SpdxLicense
*/
class CycloneDxReporter : Reporter {
companion object {
val DEFAULT_SCHEMA_VERSION = CycloneDxSchema.Version.VERSION_14
val DEFAULT_SCHEMA_VERSION = CycloneDxSchema.Version.VERSION_15
val DEFAULT_DATA_LICENSE = SpdxLicense.CC0_1_0

const val REPORT_BASE_FILENAME = "bom.cyclonedx"
Expand Down Expand Up @@ -155,12 +155,15 @@ class CycloneDxReporter : Reporter {

val metadata = Metadata().apply {
timestamp = Date()
tools = listOf(
Tool().apply {
name = ORT_FULL_NAME
version = Environment.ORT_VERSION
}
)
toolChoice = ToolInformation().apply {
components = listOf(
Component().apply {
type = Component.Type.APPLICATION
name = ORT_FULL_NAME
version = Environment.ORT_VERSION
}
)
}
licenseChoice = LicenseChoice().apply { expression = dataLicense }
}

Expand Down