Skip to content

Cyclone dx java - matching - #2057

Merged
github-actions[bot] merged 4 commits into
quay:mainfrom
crozzy:cyclone-dx-java-match
Oct 27, 2026
Merged

github-actions[bot] merged 4 commits into
quay:mainfrom
crozzy:cyclone-dx-java-match

Conversation

@crozzy

@crozzy crozzy commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@crozzy
crozzy force-pushed the cyclone-dx-java-match branch 4 times, most recently from 8be49b9 to ee6f9ff Compare October 9, 2026 21:45
@crozzy crozzy changed the title Cyclone dx java match Cyclone dx java - matching Oct 9, 2026
@crozzy
crozzy force-pushed the cyclone-dx-java-match branch 8 times, most recently from 1237ce6 to f677e0d Compare October 19, 2026 22:40
@crozzy
crozzy force-pushed the cyclone-dx-java-match branch 2 times, most recently from 91b5dc7 to 3d92286 Compare October 21, 2026 17:51
@crozzy
crozzy marked this pull request as ready for review October 21, 2026 18:16
@crozzy
crozzy requested review from a team as code owners October 21, 2026 18:16
@crozzy
crozzy requested a review from hdonnay October 21, 2026 18:16
@BradLugo
BradLugo self-requested a review October 23, 2026 18:31
RepositoryKey is the key for a Red Hat product CPE attributed to a Java component.

Signed-off-by: crozzy <joseph.crosland@gmail.com>
pkg:maven rows are now accepted. The package name is namespace:name,
ignoring repository_url and type. FixedInVersion is the PURL version
for a fixed row. Maven known_not_affected rows are skipped, and a
versioned known_affected Maven PURL is not ingested.

TODO: resolve what a version on a known_affected Maven PURL means.
TODO: move the feed URL back to the production vex-feed once Maven data is published there.
Signed-off-by: crozzy <joseph.crosland@gmail.com>
@crozzy
crozzy force-pushed the cyclone-dx-java-match branch from 3d92286 to 01e8d32 Compare October 23, 2026 21:37

@BradLugo BradLugo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have some other discussion points, but won't block on them for the sake of time

Comment thread rhel/java/matcher.go Outdated
slog.WarnContext(ctx, "unable to unbind repo CPE", "reason", err, "vulnerability name", vuln.Name)
return false, nil
}
if !cpe.Compare(vuln.Repo.CPE, record.Repository.CPE).IsSuperset() && !rhel.IsCPESubstringMatch(record.Repository.CPE, vuln.Repo.CPE) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suspect substring matching will produce unexpected results (e.g., 1 > 10)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hmmm, yeah, that seems like an original bug in the CPE subset matching. Honestly I feel like this could deserve its own PR but it makes backporting more annoying. I will include a fix in a commit here and we can discuss it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The matcher selects redhat-java-cpe-repository records. It applies the
RHEL CPE check, then compares Maven versions: an installed package is
vulnerable when it is strictly older than FixedInVersion, and an empty
FixedInVersion matches any installed version.

Signed-off-by: crozzy <joseph.crosland@gmail.com>
@crozzy
crozzy force-pushed the cyclone-dx-java-match branch 3 times, most recently from 9e7e92b to c2f47ea Compare October 26, 2026 17:01
@crozzy
crozzy requested a review from BradLugo October 26, 2026 17:02
Comment thread rhel/java/matcher.go
if vuln.FixedInVersion == "" {
return true, nil
}
installed, err := maven.ParseVersion(record.Package.Version)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it may be possible to have an empty ("") record.Package.Version

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will check and return not vulnerable if the record.Package.Version is empty

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

BradLugo
BradLugo previously approved these changes Oct 26, 2026
A whole-string prefix matched version 1 to version 10 and treated a dot in
any attribute as a boundary. Extend the pattern version when the indexed
version continues with a dot, then compare the CPEs once with the normal
superset rules. Version 4 still matches 4.13.

Signed-off-by: crozzy <joseph.crosland@gmail.com>
@crozzy

crozzy commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

/fast-forward

@github-actions
github-actions Bot merged commit 868672d into quay:main Oct 27, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants