Skip to content

fix(ecosystems): lineage-aware version comparison for Docker Hardened Images - #5716

Open
aubm wants to merge 4 commits into
google:masterfrom
aubm:dhi-ecosystem-version-comparator
Open

fix(ecosystems): lineage-aware version comparison for Docker Hardened Images#5716
aubm wants to merge 4 commits into
google:masterfrom
aubm:dhi-ecosystem-version-comparator

Conversation

@aubm

@aubm aubm commented Jul 27, 2026

Copy link
Copy Markdown

Docker Hardened Images was registered as a SemverEcosystem, but DHI OS packages are repackaged Alpine (apk) and Debian (dpkg) packages that keep their upstream version syntax (e.g. 8.4.0-r0, 7.88.1-10+deb13u2). Semver comparison mis-orders these — it compares the apk -rN release lexically (so r10 sorts before r2) and does not understand Debian epochs/revisions.

This adds a DHIEcosystem helper that delegates version handling to the lineage ecosystem named in the <lineage>:<release> suffix — Alpine/APK for …:Alpine:<rel>, Debian for …:Debian:<rel> — mirroring the existing TuxCareEcosystem wrap-an-inner pattern. As a result Docker Hardened Images is no longer reported as semver.

Tests added in osv/ecosystems/_ecosystems_test.py. Relates to #4388.

🤖 Generated with Claude Code

@google-cla

google-cla Bot commented Jul 27, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@aubm
aubm force-pushed the dhi-ecosystem-version-comparator branch from e4b919a to c44a973 Compare July 27, 2026 17:28
@aubm aubm mentioned this pull request Jul 27, 2026
6 tasks
…ened Images

Docker Hardened Images was registered as a SemverEcosystem, but DHI OS packages
are repackaged Alpine (apk) and Debian (dpkg) packages that keep their upstream
version syntax (e.g. "8.4.0-r0", "7.88.1-10+deb13u2"). Semver comparison
mis-orders these -- it compares the apk "-rN" release lexically (so r10 < r2)
and does not understand Debian epochs/revisions.

Add a DHIEcosystem helper that delegates version handling to the lineage
ecosystem named in the "<lineage>:<release>" suffix (Alpine/APK for
"...:Alpine:<rel>", Debian for "...:Debian:<rel>"), mirroring the
TuxCareEcosystem wrap-an-inner pattern.
@aubm
aubm force-pushed the dhi-ecosystem-version-comparator branch from c44a973 to 68ab228 Compare July 27, 2026 19:09
@Ly-Joey

Ly-Joey commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Hi @aubm, similar to #5715, our ecosystem related logic has also been migrated to Go. Please add your changes to go/osv/ecosystem instead.

Per review feedback on google#5716, the ecosystem logic has migrated to Go, so this
implements Docker Hardened Images version comparison in go/osv/ecosystem and
removes the earlier Python implementation.

Register DHI with a lineage-aware factory that delegates version handling to
the ecosystem named in the :Alpine:/:Debian: suffix (apk / dpkg), mirroring
tuxcareFactory. IsSemver is false: DHI uses ECOSYSTEM ranges and apk/dpkg
version ordering, not SemVer.
@aubm

aubm commented Jul 28, 2026

Copy link
Copy Markdown
Author

Hi @aubm, similar to #5715, our ecosystem related logic has also been migrated to Go. Please add your changes to go/osv/ecosystem instead.

Thanks @Ly-Joey! Should be good to test now.

@Ly-Joey
Ly-Joey requested a review from michaelkedar July 31, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants