github.com/quay/claircore@v1.5.28/nodejs/matcher.go (about) 1 package nodejs 2 3 import ( 4 "context" 5 "github.com/quay/claircore" 6 "github.com/quay/claircore/libvuln/driver" 7 ) 8 9 var ( 10 _ driver.Matcher = (*Matcher)(nil) 11 _ driver.VersionFilter = (*Matcher)(nil) 12 ) 13 14 // Matcher attempts to correlate discovered nodejs packages with reported vulnerabilities. 15 type Matcher struct{} 16 17 // Name implements driver.Matcher. 18 func (*Matcher) Name() string { return "nodejs" } 19 20 // Filter implements driver.Matcher. 21 func (*Matcher) Filter(record *claircore.IndexRecord) bool { 22 return record.Repository != nil && record.Repository.Name == repository 23 } 24 25 // Query implements driver.Matcher. 26 func (*Matcher) Query() []driver.MatchConstraint { 27 return []driver.MatchConstraint{driver.RepositoryName} 28 } 29 30 // Vulnerable implements driver.Matcher. 31 func (*Matcher) Vulnerable(_ context.Context, _ *claircore.IndexRecord, _ *claircore.Vulnerability) (bool, error) { 32 // no-op 33 return false, nil 34 } 35 36 func (*Matcher) VersionFilter() {} 37 func (*Matcher) VersionAuthoritative() bool { return true }