mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
* feat: add initial dotnet-support Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * fix: add path, sha512 and hashpath Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * fix: add missing dot Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * fix: lint warnings Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * fix CLI test package counts to account for dotnet Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * fix: updated packagurl-go Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * tidy go.sum Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update json schema Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Co-authored-by: Alex Goodman <alex.goodman@anchore.com>
92 lines
3.5 KiB
Go
92 lines
3.5 KiB
Go
/*
|
|
Package cataloger provides the ability to process files from a container image or file system and discover packages
|
|
(gems, wheels, jars, rpms, debs, etc). Specifically, this package contains both a catalog function to utilize all
|
|
catalogers defined in child packages as well as the interface definition to implement a cataloger.
|
|
*/
|
|
package cataloger
|
|
|
|
import (
|
|
"github.com/anchore/syft/syft/artifact"
|
|
"github.com/anchore/syft/syft/pkg"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/apkdb"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/dart"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/deb"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/dotnet"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/golang"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/java"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/javascript"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/php"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/python"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/rpmdb"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/ruby"
|
|
"github.com/anchore/syft/syft/pkg/cataloger/rust"
|
|
"github.com/anchore/syft/syft/source"
|
|
)
|
|
|
|
// Cataloger describes behavior for an object to participate in parsing container image or file system
|
|
// contents for the purpose of discovering Packages. Each concrete implementation should focus on discovering Packages
|
|
// for a specific Package Type or ecosystem.
|
|
type Cataloger interface {
|
|
// Name returns a string that uniquely describes a cataloger
|
|
Name() string
|
|
// Catalog is given an object to resolve file references and content, this function returns any discovered Packages after analyzing the catalog source.
|
|
Catalog(resolver source.FileResolver) ([]pkg.Package, []artifact.Relationship, error)
|
|
}
|
|
|
|
// ImageCatalogers returns a slice of locally implemented catalogers that are fit for detecting installations of packages.
|
|
func ImageCatalogers(cfg Config) []Cataloger {
|
|
return []Cataloger{
|
|
ruby.NewGemSpecCataloger(),
|
|
python.NewPythonPackageCataloger(),
|
|
php.NewPHPComposerInstalledCataloger(),
|
|
javascript.NewJavascriptPackageCataloger(),
|
|
deb.NewDpkgdbCataloger(),
|
|
rpmdb.NewRpmdbCataloger(),
|
|
java.NewJavaCataloger(cfg.Java()),
|
|
apkdb.NewApkdbCataloger(),
|
|
golang.NewGoModuleBinaryCataloger(),
|
|
dotnet.NewDotnetDepsCataloger(),
|
|
}
|
|
}
|
|
|
|
// DirectoryCatalogers returns a slice of locally implemented catalogers that are fit for detecting packages from index files (and select installations)
|
|
func DirectoryCatalogers(cfg Config) []Cataloger {
|
|
return []Cataloger{
|
|
ruby.NewGemFileLockCataloger(),
|
|
python.NewPythonIndexCataloger(),
|
|
python.NewPythonPackageCataloger(),
|
|
php.NewPHPComposerLockCataloger(),
|
|
javascript.NewJavascriptLockCataloger(),
|
|
deb.NewDpkgdbCataloger(),
|
|
rpmdb.NewRpmdbCataloger(),
|
|
java.NewJavaCataloger(cfg.Java()),
|
|
apkdb.NewApkdbCataloger(),
|
|
golang.NewGoModuleBinaryCataloger(),
|
|
golang.NewGoModFileCataloger(),
|
|
rust.NewCargoLockCataloger(),
|
|
dart.NewPubspecLockCataloger(),
|
|
dotnet.NewDotnetDepsCataloger(),
|
|
}
|
|
}
|
|
|
|
// AllCatalogers returns all implemented catalogers
|
|
func AllCatalogers(cfg Config) []Cataloger {
|
|
return []Cataloger{
|
|
ruby.NewGemFileLockCataloger(),
|
|
ruby.NewGemSpecCataloger(),
|
|
python.NewPythonIndexCataloger(),
|
|
python.NewPythonPackageCataloger(),
|
|
javascript.NewJavascriptLockCataloger(),
|
|
javascript.NewJavascriptPackageCataloger(),
|
|
deb.NewDpkgdbCataloger(),
|
|
rpmdb.NewRpmdbCataloger(),
|
|
java.NewJavaCataloger(cfg.Java()),
|
|
apkdb.NewApkdbCataloger(),
|
|
golang.NewGoModuleBinaryCataloger(),
|
|
golang.NewGoModFileCataloger(),
|
|
rust.NewCargoLockCataloger(),
|
|
dart.NewPubspecLockCataloger(),
|
|
dotnet.NewDotnetDepsCataloger(),
|
|
}
|
|
}
|