Fix mix.lock git/path deps mislabeled as hex.pm packages with bogus PURLs#5041
Merged
Merged
Conversation
parseMixLock read the version from a hex-only token position and hardcoded a pkg:hex PURL, so git/path deps got a URL-fragment version and a false hex.pm PURL (false CVE matches). Branch on the source atom: git uses the commit SHA, path an empty version, and pkg:hex PURLs are emitted only for hex deps. Signed-off-by: Synvoya <16019863+Synvoya@users.noreply.github.com>
wagoodman
approved these changes
Jul 6, 2026
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.
Description
mix.lockgit and path dependencies were mislabeled as hex.pm packages with a garbage version and a boguspkg:hex/...PURL — a source of false hex.pm vulnerability matches.parseMixLockread the version from a fixed token position (tokens[4]) that only holds forhexentries. For a git entry liketokens[4]is a URL fragment, and the type/PURL were hardcoded to hex, so syft emitted version//github.com/aeternity/enacl.gitwith PURLpkg:hex/enacl@%2F%2Fgithub.com....Fix
Branch on the source atom (
hex/git/path):pkg:hex/PURL.pkg:hex/PURL.The
pkg:hex/PURL is now emitted only for hex-sourced deps, which removes the false hex.pm matches. I kept the metadata type as the existing Elixir mix-lock entry to avoid changing the versioned JSON schema — happy to surface git/path deps asUnknownPackageinstead if you'd prefer.Test
Added git and path entries to
testdata/mix.lockwith expected name/version/PURL asserted inparse_mix_lock_test.go; all existing hex expectations are unchanged.