-
Notifications
You must be signed in to change notification settings - Fork 1
/
deprecated.go
37 lines (31 loc) · 1.37 KB
/
deprecated.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package govulners
import (
"github.com/nextlinux/govulners/govulners/match"
"github.com/nextlinux/govulners/govulners/matcher"
"github.com/nextlinux/govulners/govulners/pkg"
"github.com/nextlinux/govulners/govulners/store"
"github.com/nextlinux/stereoscope/pkg/image"
"github.com/anchore/syft/syft/linux"
"github.com/anchore/syft/syft/pkg/cataloger"
"github.com/anchore/syft/syft/source"
)
// TODO: deprecated, remove in v1.0.0
func FindVulnerabilities(store store.Store, userImageStr string, scopeOpt source.Scope, registryOptions *image.RegistryOptions) (match.Matches, pkg.Context, []pkg.Package, error) {
providerConfig := pkg.ProviderConfig{
SyftProviderConfig: pkg.SyftProviderConfig{
RegistryOptions: registryOptions,
CatalogingOptions: cataloger.DefaultConfig(),
},
}
providerConfig.CatalogingOptions.Search.Scope = scopeOpt
packages, context, _, err := pkg.Provide(userImageStr, providerConfig)
if err != nil {
return match.Matches{}, pkg.Context{}, nil, err
}
matchers := matcher.NewDefaultMatchers(matcher.Config{})
return FindVulnerabilitiesForPackage(store, context.Distro, matchers, packages), context, packages, nil
}
// TODO: deprecated, remove in v1.0.0
func FindVulnerabilitiesForPackage(store store.Store, d *linux.Release, matchers []matcher.Matcher, packages []pkg.Package) match.Matches {
return matcher.FindMatches(store, d, matchers, packages)
}