Skip to content

Detect CycloneDX XML SBOMs in the SBOM endpoint - #51837

Closed
sonderhq wants to merge 1 commit into
spring-projects:mainfrom
sonderhq:gh-51836
Closed

sonderhq wants to merge 1 commit into
spring-projects:mainfrom
sonderhq:gh-51836

Conversation

@sonderhq

Copy link
Copy Markdown

The SBOM endpoint auto-detects an SBOM's media type when none is configured, but the detection only knows JSON formats: a CycloneDX XML SBOM falls through to UNKNOWN and the endpoint then serves it without a content type. The reference documentation tells Maven users to add the cyclonedx-maven-plugin, whose default output format is XML, so the documented default setup hits this.

This adds a CYCLONE_DX_XML case carrying application/vnd.cyclonedx+xml, matched on the CycloneDX XML namespace (http://cyclonedx.org/schema/bom/, which does not collide with the JSON $schema value http://cyclonedx.org/schema/bom-1.5.schema.json).

Behaviour is unchanged for explicitly configured media types (they keep precedence) and for genuinely unknown files (still no content type).

Fixes #51836

Testing:

  • new shouldAutoDetectContentTypeForCycloneDxXml() — red before the change (content type was null), green after
  • shouldAutodetectFormats now also covers the new case and keeps asserting the formats stay mutually exclusive
  • :module:spring-boot-actuator:test --tests "org.springframework.boot.actuate.sbom.*": 19 tests, 0 failures (17 on the same base commit without the two new tests)
  • :module:spring-boot-actuator:checkstyleMain checkstyleTest and :module:spring-boot-actuator:format pass

The commit includes the required Signed-off-by trailer.

The SBOM endpoint auto-detects the media type of an SBOM when no media
type is configured. Detection only recognized JSON formats, so a
CycloneDX XML SBOM (the default output of the cyclonedx-maven-plugin
that the reference documentation tells Maven users to add) fell through
to unknown and was served without its content type.

Add a CYCLONE_DX_XML case carrying application/vnd.cyclonedx+xml,
matched on the CycloneDX XML namespace. Explicitly configured media
types and genuinely unknown files keep their previous behaviour.

Closes spring-projectsgh-51836

Signed-off-by: wuwei <ww_xyy@163.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 18, 2026
@wilkinsona wilkinsona added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 18, 2026
@wilkinsona wilkinsona closed this Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: declined A suggestion or change that we don't feel we should currently apply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SBOM endpoint does not auto-detect CycloneDX XML, so the documented Maven setup serves the SBOM without its content type

3 participants