Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix version detection in Java archive name parsing #1889

Merged
merged 1 commit into from
Jun 22, 2023

Conversation

luhring
Copy link
Contributor

@luhring luhring commented Jun 22, 2023

There was a bug, caused by someone who shall remain nameless, where parsing the package name and version from a Java archive filename treated any strings that began with "build" as versions.

This leads to a large number of false positives in Grype because it feeds invalid versions into Grype's version comparison logic.

I believe the original intent was to ensure build numbers were treated as version components, which is valid, but when the package name included "build" with no number directly following (such as in gradle-build-cache-8.1.1), the "build" was automatically starting the version data, not continuing the package name data.

This has been addressed by changing * to + in a regex. 😆

Copy link
Contributor

@kzantow kzantow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@kzantow kzantow enabled auto-merge (squash) June 22, 2023 18:30
@kzantow kzantow merged commit 7de7a79 into anchore:main Jun 22, 2023
@luhring luhring deleted the fix-java-archive-version-parsing branch June 22, 2023 18:45
@kzantow kzantow added the bug Something isn't working label Jun 29, 2023
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants