Fix regenerator: repackaged jar's embedded Maven metadata misattributed to the artifact - #230
Merged
Merged
Conversation
…ta as the artifact
syft reports carrot2-guava-18.0.jar (a shade of guava that still ships guava's
META-INF/maven/com.google.guava/guava/pom.properties) as a *standalone*
com.google.guava:guava@18.0 with virtualPath '/carrot2-guava-18.0.jar' -- no ':'
nesting marker, so the existing shaded-inside-another-archive filter missed it.
The result was a spurious "resolved 18.0 vs on-file 25.1-jre" conflict for guava
across Solr 8.1.0-8.7.0 (exactly the range that bundles carrot2-guava, which is
tracked separately as org.carrot2.shaded:carrot2-guava).
Strengthen the filter to also require the on-disk jar filename to start with the
purl's artifact ('<artifact>-'), so a differently-named repackaged jar can't
masquerade as the artifact whose pom.properties it happens to carry. The real
guava-25.1-jre.jar is kept; carrot2-guava-18.0.jar and junit4-ant's embedded
guava are dropped. Verified by syft-scanning both jars together.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Running
regenerate_dependency_mappings.pyreported 15 spurious conflicts for guava across Solr 8.1.0–8.7.0:The on-file
25.1-jreis correct. The images ship onlyguava-25.1-jre.jarinWEB-INF/lib; the18.0comes fromcarrot2-guava-18.0.jar(in theclusteringcontrib), a shaded repackaging of guava that still carries guava'sMETA-INF/maven/com.google.guava/guava/pom.properties. syft therefore reports it as a standalonecom.google.guava:guava@18.0withvirtualPath = '/carrot2-guava-18.0.jar'— no:nesting marker, so the existing "shaded inside another archive" filter (_is_standalone_jar) didn't catch it. The disagreement range (8.1.0–8.7.0) matches exactly wherecarrot2-guavais bundled (it's removed in 8.8.0+, and tracked separately asorg.carrot2.shaded:carrot2-guava).Fix: require the on-disk jar filename to start with the purl's artifact (
<artifact>-), so a differently-named repackaged jar can't masquerade as the artifact whosepom.propertiesit happens to carry. A genuine standalone jar is named<artifactId>-<version>[-classifier].jar, soguava-25.1-jre.jaris kept whilecarrot2-guava-18.0.jar(and junit4-ant's embedded guava) are dropped. The:-nesting check and the older-syft fallback are preserved.Verified by syft-scanning
guava-25.1-jre.jarandcarrot2-guava-18.0.jartogether: the updatediter_maven_packagesyields onlycom.google.guava:guava@25.1-jre.Data-only change is not needed — the map's
25.1-jrevalues were already right; this just stops the regenerator from flagging them as false conflicts. (solr-dependency-versions.jsonis untouched here.)