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

Implement SBOM actuator endpoint #39799

Closed

Conversation

mhalbritter
Copy link
Contributor

@mhalbritter mhalbritter commented Feb 29, 2024

This adds an endpoint which exposes SBOMs.

/actuator/sbom returns a list of all available SBOMs:

{
    "ids": [
        "application"
    ]
}

/actuator/sbom/{id} returns the content of a specific SBOM:

HTTP/1.1 200 
Accept-Ranges: bytes
Content-Type: application/vnd.cyclonedx+json
Content-Length: 167432

{
  "bomFormat" : "CycloneDX",
  "specVersion" : "1.5",
  "serialNumber" : "urn:uuid:c34c8afc-f4f2-45a9-84d7-394f31b549b6",
  "version" : 1,
  // ...

It configures the cyclonedx-maven-plugin and the cyclonedx-gradle-plugin, if included in the project, to create a CycloneDX sbom. This SBOM is then returned in on the sbom/application actuator endpoint. It also includes the SBOM in the uber JAR, and adds two manifest entries (Sbom-Format and Sbom-Location) to point to it, so that 3rd party tools can find the SBOM.

With configuration properties under management.endpoint.sbom, users can override the application SBOM location and override the detected media type (it autodetects CycloneDX JSON, Syft JSON and SPDX JSON). This way, if users want to expose an SBOM in a different format, it works. Those properties also allow users to expose further SBOMS, e.g. with this configuration:

management.endpoint.sbom.additional.buildpacks-lifecycle.location=optional:file:/layers/sbom/launch/buildpacksio_lifecycle/launcher/sbom.cdx.json
management.endpoint.sbom.additional.buildpacks-liberica-helper.location=optional:file:/layers/sbom/launch/paketo-buildpacks_bellsoft-liberica/helper/sbom.syft.json
management.endpoint.sbom.additional.buildpacks-liberica-jre.location=optional:file:/layers/sbom/launch/paketo-buildpacks_bellsoft-liberica/jre/sbom.syft.json
management.endpoint.sbom.additional.buildpacks-ca-certificates.location=optional:file:/layers/sbom/launch/paketo-buildpacks_ca-certificates/helper/sbom.syft.json
management.endpoint.sbom.additional.buildpacks-executable-jar.location=optional:file:/layers/sbom/launch/paketo-buildpacks_executable-jar/sbom.cdx.json
management.endpoint.sbom.additional.buildpacks-spring-boot-helper.location=optional:file:/layers/sbom/launch/paketo-buildpacks_spring-boot/helper/sbom.syft.json
management.endpoint.sbom.additional.buildpacks-spring-boot-spring-cloud-bindings.location=optional:file:/layers/sbom/launch/paketo-buildpacks_spring-boot/spring-cloud-bindings/sbom.syft.json

additional SBOMs are exported when using the paketo buildpacks.

To activate the support, users have to add the Gradle plugin

plugins {
  id 'org.cyclonedx.bom' version '1.8.2'
}

or the maven plugin

<plugin>
  <groupId>org.cyclonedx</groupId>
  <artifactId>cyclonedx-maven-plugin</artifactId>
</plugin>

to their build. We manage the version of the cyclonedx-maven-plugin.
Don't forget to expose the sbom endpoint with management.endpoints.web.exposure.include=sbom!

@mhalbritter mhalbritter added the type: enhancement A general enhancement label Feb 29, 2024
@mhalbritter mhalbritter added this to the 3.3.0-M3 milestone Feb 29, 2024
@mhalbritter mhalbritter added the status: blocked An issue that's blocked on an external project change label Feb 29, 2024
@mhalbritter
Copy link
Contributor Author

Blocked until the doc work by Phil is done.

@jonatan-ivanov jonatan-ivanov mentioned this pull request Mar 12, 2024
15 tasks
@philwebb philwebb removed the status: blocked An issue that's blocked on an external project change label Mar 22, 2024
@philwebb philwebb closed this in 4047c00 Mar 22, 2024
@mhalbritter mhalbritter deleted the mh/sbom-endpoint branch March 22, 2024 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants