Skip to content

Bump cyclonedx-core-java to 13.0.0, add CycloneDX 1.7 support, test all schema versions - #673

Open
patbaumgartner wants to merge 4 commits into
CycloneDX:masterfrom
patbaumgartner:issue-564-bump-core-java-13
Open

Bump cyclonedx-core-java to 13.0.0, add CycloneDX 1.7 support, test all schema versions#673
patbaumgartner wants to merge 4 commits into
CycloneDX:masterfrom
patbaumgartner:issue-564-bump-core-java-13

Conversation

@patbaumgartner

Copy link
Copy Markdown

Fixes #564

What

Bump cyclonedx-core-java 9.0.5 -> 13.0.0

This picks up the fix for the Unknown keyword meta:enum / Unknown keyword deprecated warnings emitted during JSON BOM validation (CycloneDX/cyclonedx-core-java#280, fixed and released in core-java 13.0.0). The makeBom IT now asserts that no Unknown keyword warning appears in the build log while JSON validation still runs and passes.

CycloneDX 1.7 support

core-java 13.0.0 supports schema 1.7, so schemaVersion=1.7 is now accepted. Following the existing convention that the default tracks the latest supported schema, the default (and the fallback for invalid values, as asserted by VerboseTest via CycloneDxSchema.VERSION_LATEST) is now 1.7. Note for reviewers: this is a behavior change - if you prefer to keep 1.6 as the default and only support 1.7 opt-in, I'm happy to adjust.

Systematic test coverage for all schema versions

Existing tests only exercised schema versions 1.2/1.3/1.4/1.6 incidentally through issue reproducers. The new SchemaVersionsTest generates and validates a BOM for every supported version: 1.0 and 1.1 (XML only, JSON was introduced with 1.2) and 1.2-1.7 (XML + JSON), asserting the requested version is accepted as-is, ends up in the output (xmlns / specVersion), and no Unknown keyword warning is logged.

Bugfix: invalid license/url element in 1.0 BOMs

The new test immediately uncovered that schemaVersion=1.0 produced a BOM that fails the plugin's own XSD validation: a <url> element inside <license>, which only exists since schema 1.1. This looks pre-existing and independent of the dependency bump. Fixed in DefaultModelConverter by not emitting the license url for 1.0, consistent with the existing VERSION_10 guards.

Verification

  • mvn clean verify green: 26 unit tests + 2 invoker ITs
  • both IT build logs contain Writing and validating BOM (JSON) with zero Unknown keyword warnings

@codacy-production

codacy-production Bot commented Jul 24, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 17 complexity · 0 duplication

Metric Results
Complexity 17
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

- upgrade cyclonedx-core-java 9.0.5 -> 13.0.0, which fixes the
  'Unknown keyword meta:enum/deprecated' warnings during JSON BOM
  validation
- add schema version 1.7 to the supported versions, with 1.7 as the
  new default and fallback for invalid values
- assert in the makeBom IT that no 'Unknown keyword' warning is logged

Fixes CycloneDX#564

Signed-off-by: Patrick Baumgartner <contact@patbaumgartner.com>
… BOMs

- add SchemaVersionsTest generating and validating BOMs for every
  supported schema version: 1.0/1.1 (XML only) and 1.2-1.7 (XML+JSON)
- fix DefaultModelConverter emitting a license url element for
  schemaVersion 1.0, which is not allowed by the 1.0 XSD and made the
  plugin's own BOM validation fail

Signed-off-by: Patrick Baumgartner <contact@patbaumgartner.com>
@patbaumgartner
patbaumgartner force-pushed the issue-564-bump-core-java-13 branch from 891574d to 49f4c3a Compare July 24, 2026 20:10
@patbaumgartner patbaumgartner changed the title Issue 564 bump core java 13 Bump cyclonedx-core-java to 13.0.0, add CycloneDX 1.7 support, test all schema versions Jul 24, 2026
@hboutemy hboutemy added the major-rfe Major Enhancement label Jul 29, 2026
@hboutemy hboutemy added this to the 2.10.0 milestone Jul 29, 2026
@patbaumgartner

Copy link
Copy Markdown
Author

The CI failure on Java 8 (java.security.NoSuchAlgorithmException: SHA3-256 MessageDigest not available) is fixed in 9d45891.

Root cause: cyclonedx-core-java 9.x silently skipped hash algorithms that are unavailable on the current JVM, but since the rewrite of BomUtils.calculateHashes(file, schemaVersion) it fails hard when a requested MessageDigest is missing. SHA3 digests only ship with the JDK since Java 9, so the plugin's Java 8 builds broke.

Fix: DefaultModelConverter now calls the BomUtils.calculateHashes(file, schemaVersion, algorithms) overload introduced in core-java 9.2.0, passing only algorithms that are supported by both:

  • the current JVM — probed once via MessageDigest.getInstance(algorithm.getSpec()) over Hash.Algorithm.values(), and
  • the target schema version — derived from the same @VersionFilter annotations that BomUtils uses internally.

No algorithm names are hardcoded, so future algorithms added to Hash.Algorithm are picked up automatically, and BLAKE/STREEBOG hashes would be included if a third-party security provider (e.g. BouncyCastle) is registered.

Behavior: on Java 9+ the BOM output is unchanged; on Java 8 the SHA3 hashes are omitted — the same behavior as the currently released plugin versions.

Verified locally: full test suite passes on JDK 8 (Corretto 8.0.472, reproduces the CI failure without the fix) and JDK 21.

cyclonedx-core-java 13 no longer silently skips hash algorithms that are
unavailable on the current JVM, so BomUtils.calculateHashes(file, schemaVersion)
fails on Java 8 with 'SHA3-256 MessageDigest not available'.

Calculate hashes via the calculateHashes(file, schemaVersion, algorithms)
overload instead, passing only algorithms that are supported by both the
current JVM (probed via MessageDigest) and the target schema version
(derived from the @VersionFilter annotations on Hash.Algorithm). On Java 8
this restores the pre-13 behavior of omitting SHA3 hashes; on Java 9+ the
BOM output is unchanged.

Signed-off-by: Patrick Baumgartner <contact@patbaumgartner.com>
@patbaumgartner
patbaumgartner force-pushed the issue-564-bump-core-java-13 branch from 9d45891 to e772c7c Compare July 29, 2026 20:34
@hboutemy hboutemy modified the milestones: 2.9.3, 2.10.0 Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major-rfe Major Enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WARNING] Unknown keyword meta:[enum|deprecated] - you should define your own Meta Schema

2 participants