Bump cyclonedx-core-java to 13.0.0, add CycloneDX 1.7 support, test all schema versions - #673
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 17 |
| Duplication | 0 |
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>
891574d to
49f4c3a
Compare
|
The CI failure on Java 8 ( Root cause: cyclonedx-core-java 9.x silently skipped hash algorithms that are unavailable on the current JVM, but since the rewrite of Fix:
No algorithm names are hardcoded, so future algorithms added to 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>
9d45891 to
e772c7c
Compare
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 deprecatedwarnings emitted during JSON BOM validation (CycloneDX/cyclonedx-core-java#280, fixed and released in core-java 13.0.0). ThemakeBomIT now asserts that noUnknown keywordwarning 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.7is now accepted. Following the existing convention that the default tracks the latest supported schema, the default (and the fallback for invalid values, as asserted byVerboseTestviaCycloneDxSchema.VERSION_LATEST) is now1.7. Note for reviewers: this is a behavior change - if you prefer to keep1.6as 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
SchemaVersionsTestgenerates 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 noUnknown keywordwarning is logged.Bugfix: invalid
license/urlelement in 1.0 BOMsThe new test immediately uncovered that
schemaVersion=1.0produced 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 inDefaultModelConverterby not emitting the license url for 1.0, consistent with the existingVERSION_10guards.Verification
mvn clean verifygreen: 26 unit tests + 2 invoker ITsWriting and validating BOM (JSON)with zeroUnknown keywordwarnings