Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions internal/clients/clientimpl/osvmatcher/osvmatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/google/osv-scanner/v2/internal/cachedregexp"
"github.com/google/osv-scanner/v2/internal/cmdlogger"
"github.com/google/osv-scanner/v2/internal/imodels"
"github.com/google/osv-scanner/v2/internal/tuxcare"
"github.com/ossf/osv-schema/bindings/go/osvconstants"
"github.com/ossf/osv-schema/bindings/go/osvschema"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -139,6 +140,19 @@ func (matcher *OSVMatcher) MatchVulnerabilities(ctx context.Context, pkgs []*ext
}

func pkgToQuery(pkg *extractor.Package) *api.Query {
// Route vendor-rebuilt packages (e.g. TuxCare) before the base-ecosystem gate
// below. This must run even when the package has no base ecosystem — scalibr
// leaves CentOS/Oracle RPMs without one — so it cannot be gated on a non-empty
// base ecosystem. routedQueryPackage already requires a name and version.
if routed := routedQueryPackage(pkg); routed != nil {
return &api.Query{
Package: routed,
Param: &api.Query_Version{
Version: tuxcare.QueryVersion(pkg),
},
}
}

if imodels.Name(pkg) != "" && !imodels.Ecosystem(pkg).IsEmpty() && imodels.Version(pkg) != "" {
name := imodels.Name(pkg)

Expand Down
Loading