Skip to content

Commit 8dd6a35

Browse files
committed
rhel: add repo_key matching constraint
As the matcher now no longer queries on repo name, it means the result set returned from the DB is a lot larger. This change limits the results to just those added by the RHEL updater (previously OVAL now VEX). Signed-off-by: crozzy <[email protected]>
1 parent 64d2456 commit 8dd6a35

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

datastore/postgres/querybuilder.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ func buildGetQuery(record *claircore.IndexRecord, opts *datastore.GetOpts) (stri
7171
ex = goqu.Ex{"dist_arch": record.Distribution.Arch}
7272
case driver.RepositoryName:
7373
ex = goqu.Ex{"repo_name": record.Repository.Name}
74+
case driver.RepositoryKey:
75+
ex = goqu.Ex{"repo_key": record.Repository.Key}
7476
case driver.HasFixedInVersion:
7577
ex = goqu.Ex{"fixed_in_version": goqu.Op{exp.NeqOp.String(): ""}}
7678
default:

libvuln/driver/matcher.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const (
4141
DistributionPrettyName
4242
// should match claircore.Package.Repository.Name => claircore.Vulnerability.Package.Repository.Name
4343
RepositoryName
44+
// should match claircore.Package.Repository.Key => claircore.Vulnerability.Package.Repository.Key
45+
RepositoryKey
4446
// should match claircore.Vulnerability.FixedInVersion != ""
4547
HasFixedInVersion
4648
)

rhel/matcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (*Matcher) Filter(record *claircore.IndexRecord) bool {
3131

3232
// Query implements driver.Matcher.
3333
func (m *Matcher) Query() []driver.MatchConstraint {
34-
mcs := []driver.MatchConstraint{driver.PackageModule}
34+
mcs := []driver.MatchConstraint{driver.PackageModule, driver.RepositoryKey}
3535
if m.ignoreUnpatched {
3636
mcs = append(mcs, driver.HasFixedInVersion)
3737
}

0 commit comments

Comments
 (0)