fix: normalize java runtime qualifiers in maven version comparisons#3034
fix: normalize java runtime qualifiers in maven version comparisons#3034wagoodman merged 2 commits intoanchore:mainfrom
Conversation
Signed-off-by: James Gardner <james.gardner@chainguard.dev>
|
When researching this a bit more, I found that the suffix is non-standard for Maven parsing. It supports I believe the fix is still appropriate, but let me know if I should be approaching this differently! |
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
|
Thank you for the review and help! |
* main: chore(deps): update tools to latest versions (anchore#3051) chore(deps): bump actions/checkout from 5.0.0 to 5.0.1 (anchore#3059) chore(deps): bump anchore/sbom-action from 0.20.9 to 0.20.10 (anchore#3060) chore(deps): bump github/codeql-action from 4.31.2 to 4.31.4 (anchore#3061) chore(deps): bump golang.org/x/crypto from 0.44.0 to 0.45.0 (anchore#3063) chore(deps): bump actions/setup-go in /.github/actions/bootstrap (anchore#3064) chore(deps): update anchore dependencies (anchore#3055) test: update quality gate db to latest version (anchore#3053) fix: normalize java runtime qualifiers in maven version comparisons (anchore#3034) chore(deps): update tools to latest versions (anchore#3045) fix: junit template use CDATA block to prevent XML parse errors (anchore#3019) feat: add basic VEX support for SBOM and other sources chore(deps): bump golang.org/x/tools from 0.38.0 to 0.39.0 (anchore#3046) chore(deps): bump github.com/opencontainers/selinux (anchore#3044) chore(deps): bump github.com/olekukonko/tablewriter from 1.1.0 to 1.1.1 (anchore#3039) keep nested loggers labeled (anchore#3040)
…chore/grype#3034 Signed-off-by: Kyle Steere <kyle.steere@chainguard.dev>
|
Hi Grype! I'm looking to understand your fix for this issue. From my understanding, jre8 and jre11 are different java runtimes, so it's possible that they have different code/dependencies to support the different runtimes, meaning that a bug in jre8, could not appear in jre11, and vice versa. By stripping all jreXX and jdkXX suffixes before comparing versions, is it possible that this could result in over reporting vulns? Thank you! |
The pinned scan-action (v5) bundled Grype v0.85.0 which has a false-positive for CVE-2025-59250 on mssql-jdbc due to Microsoft's non-standard version metadata. This was fixed in Grype v0.104.1+ (anchore/grype#3034). Upgrading to scan-action v7.3.2 which bundles Grype v0.107.1 resolves the false positive at the scanner level. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pinned scan-action (v5) bundled Grype v0.85.0 which has a false-positive for CVE-2025-59250 on mssql-jdbc due to Microsoft's non-standard version metadata. This was fixed in Grype v0.104.1+ (anchore/grype#3034). Upgrading to scan-action v7.3.2 which bundles Grype v0.107.1 resolves the false positive at the scanner level. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pinned scan-action (v5) bundled Grype v0.85.0 which has a false-positive for CVE-2025-59250 on mssql-jdbc due to Microsoft's non-standard version metadata. This was fixed in Grype v0.104.1+ (anchore/grype#3034). Upgrading to scan-action v7.3.2 which bundles Grype v0.107.1 resolves the false positive at the scanner level. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Fix: Normalize Java runtime qualifiers in Maven version comparisons
Problem
Maven/Java packages may include JRE/JDK runtime qualifiers in filenames (
.jreNN,.jdkNN), but these qualifiers may not appear in the JAR's internal version metadata (fromMANIFEST.MF).When Grype compares versions:
12.10.2(extracted from JAR metadata)12.10.2.jre11(from advisory database)12.10.2≠12.10.2.jre11→ False positive CVE reportedThe runtime qualifiers don't affect semantic versioning and should be normalized before comparison.
Solution
Strip
.jre<digits>and.jdk<digits>suffixes before Maven version parsing, following the existing pattern used for other version qualifiers (RELEASE, FINAL, GA).Behavior after fix:
12.10.2==12.10.2.jre11✅12.10.2.jre11==12.10.2.jdk17✅12.10.1<12.10.2.jre11✅ (actual version differences preserved)Testing
References
github.com/masahiro331/go-mvn-version(does not normalize runtime qualifiers)