Follow convention for naming catalogers (#2277)

* follow convention for naming catalogers

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix cataloger name example

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman 2023-11-02 08:39:42 -04:00 committed by GitHub
parent 6c41f15975
commit b2f4d7eda2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
144 changed files with 294 additions and 273 deletions

View file

@ -45,8 +45,8 @@ jobs:
- name: Restore RPM test-fixture cache - name: Restore RPM test-fixture cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2
with: with:
path: syft/pkg/cataloger/rpm/test-fixtures/rpms path: syft/pkg/cataloger/redhat/test-fixtures/rpms
key: ${{ runner.os }}-unit-rpm-cache-${{ hashFiles( 'syft/pkg/cataloger/rpm/test-fixtures/rpms.fingerprint' ) }} key: ${{ runner.os }}-unit-rpm-cache-${{ hashFiles( 'syft/pkg/cataloger/redhat/test-fixtures/rpms.fingerprint' ) }}
- name: Restore go binary test-fixture cache - name: Restore go binary test-fixture cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2

View file

@ -202,6 +202,14 @@ From a high level catalogers have the following properties:
- _Packages created by the cataloger should not be mutated after they are created_. There is one exception made for adding CPEs to a package after the cataloging phase, but that will most likely be moved back into the cataloger in the future. - _Packages created by the cataloger should not be mutated after they are created_. There is one exception made for adding CPEs to a package after the cataloging phase, but that will most likely be moved back into the cataloger in the future.
Cataloger names should be unique and named with the following rules of thumb in mind:
- Must end with `-cataloger`
- Use lowercase letters, numbers, and hyphens only
- Use hyphens to separate words
- Catalogers for language ecosystems should start with the language name (e.g. `python-` for a cataloger that raises up python packages)
- Distinct between when the cataloger is searching for evidence of installed packages vs declared packages. For example, there are currently two different gemspec-based catalogers, the `ruby-gemspec-cataloger` and `ruby-installed-gemspec-cataloger`, where the latter requires that the gemspec is found within a `specifications` directory (which means it was installed, not just at the root of a source repo).
#### Building a new Cataloger #### Building a new Cataloger
Catalogers must fulfill the [`pkg.Cataloger` interface](https://github.com/anchore/syft/tree/v0.70.0/syft/pkg/cataloger.go) in order to add packages to the SBOM. Catalogers must fulfill the [`pkg.Cataloger` interface](https://github.com/anchore/syft/tree/v0.70.0/syft/pkg/cataloger.go) in order to add packages to the SBOM.

View file

@ -494,7 +494,7 @@ platform: ""
# set the list of package catalogers to use when generating the SBOM # set the list of package catalogers to use when generating the SBOM
# default = empty (cataloger set determined automatically by the source type [image or file/directory]) # default = empty (cataloger set determined automatically by the source type [image or file/directory])
# catalogers: # catalogers:
# - alpmdb-cataloger # - alpm-db-cataloger
# - apkdb-cataloger # - apkdb-cataloger
# - binary-cataloger # - binary-cataloger
# - cargo-auditable-binary-cataloger # - cargo-auditable-binary-cataloger
@ -502,10 +502,10 @@ platform: ""
# - conan-cataloger # - conan-cataloger
# - dartlang-lock-cataloger # - dartlang-lock-cataloger
# - dotnet-deps-cataloger # - dotnet-deps-cataloger
# - dpkgdb-cataloger # - dpkg-db-cataloger
# - elixir-mix-lock-cataloger # - elixir-mix-lock-cataloger
# - erlang-rebar-lock-cataloger # - erlang-rebar-lock-cataloger
# - go-mod-file-cataloger # - go-module-file-cataloger
# - go-module-binary-cataloger # - go-module-binary-cataloger
# - graalvm-native-image-cataloger # - graalvm-native-image-cataloger
# - haskell-cataloger # - haskell-cataloger
@ -519,12 +519,12 @@ platform: ""
# - php-composer-installed-cataloger # - php-composer-installed-cataloger
# - php-composer-lock-cataloger # - php-composer-lock-cataloger
# - portage-cataloger # - portage-cataloger
# - python-index-cataloger
# - python-package-cataloger # - python-package-cataloger
# - python-installed-package-cataloger
# - rpm-db-cataloger # - rpm-db-cataloger
# - rpm-file-cataloger # - rpm-archive-cataloger
# - ruby-gemfile-cataloger # - ruby-gemfile-cataloger
# - ruby-gemspec-cataloger # - ruby-installed-gemspec-cataloger
# - rust-cargo-lock-cataloger # - rust-cargo-lock-cataloger
# - sbom-cataloger # - sbom-cataloger
# - spm-cataloger # - spm-cataloger

View file

@ -174,7 +174,9 @@ tasks:
unit: unit:
desc: Run unit tests desc: Run unit tests
deps: [tmpdir] deps:
- tmpdir
- fixtures
vars: vars:
TEST_PKGS: TEST_PKGS:
sh: "go list ./... | grep -v {{ .OWNER }}/{{ .PROJECT }}/test | tr '\n' ' '" sh: "go list ./... | grep -v {{ .OWNER }}/{{ .PROJECT }}/test | tr '\n' ' '"
@ -261,7 +263,7 @@ tasks:
- syft/pkg/cataloger/binary/test-fixtures/cache.fingerprint - syft/pkg/cataloger/binary/test-fixtures/cache.fingerprint
- syft/pkg/cataloger/java/test-fixtures/java-builds/cache.fingerprint - syft/pkg/cataloger/java/test-fixtures/java-builds/cache.fingerprint
- syft/pkg/cataloger/golang/test-fixtures/archs/binaries.fingerprint - syft/pkg/cataloger/golang/test-fixtures/archs/binaries.fingerprint
- syft/pkg/cataloger/rpm/test-fixtures/rpms.fingerprint - syft/pkg/cataloger/redhat/test-fixtures/rpms.fingerprint
- syft/pkg/cataloger/kernel/test-fixtures/cache.fingerprint - syft/pkg/cataloger/kernel/test-fixtures/cache.fingerprint
- test/install/cache.fingerprint - test/install/cache.fingerprint
- test/cli/test-fixtures/cache.fingerprint - test/cli/test-fixtures/cache.fingerprint
@ -275,7 +277,7 @@ tasks:
# for GO BINARY test fixtures # for GO BINARY test fixtures
- "cd syft/pkg/cataloger/golang/test-fixtures/archs && make binaries.fingerprint" - "cd syft/pkg/cataloger/golang/test-fixtures/archs && make binaries.fingerprint"
# for RPM test fixtures # for RPM test fixtures
- "cd syft/pkg/cataloger/rpm/test-fixtures && make rpms.fingerprint" - "cd syft/pkg/cataloger/redhat/test-fixtures && make rpms.fingerprint"
# for Kernel test fixtures # for Kernel test fixtures
- "cd syft/pkg/cataloger/kernel/test-fixtures && make cache.fingerprint" - "cd syft/pkg/cataloger/kernel/test-fixtures && make cache.fingerprint"
# for INSTALL integration test fixtures # for INSTALL integration test fixtures
@ -287,7 +289,7 @@ tasks:
desc: Generate test fixtures desc: Generate test fixtures
cmds: cmds:
- "cd syft/pkg/cataloger/java/test-fixtures/java-builds && make" - "cd syft/pkg/cataloger/java/test-fixtures/java-builds && make"
- "cd syft/pkg/cataloger/rpm/test-fixtures && make" - "cd syft/pkg/cataloger/redhat/test-fixtures && make"
- "cd syft/pkg/cataloger/binary/test-fixtures && make" - "cd syft/pkg/cataloger/binary/test-fixtures && make"
show-test-image-cache: show-test-image-cache:

View file

@ -31,7 +31,7 @@
"properties": [ "properties": [
{ {
"name": "syft:package:foundBy", "name": "syft:package:foundBy",
"value": "go-mod-file-cataloger" "value": "go-module-file-cataloger"
}, },
{ {
"name": "syft:package:language", "name": "syft:package:language",

View file

@ -31,7 +31,7 @@
"properties": [ "properties": [
{ {
"name": "syft:package:foundBy", "name": "syft:package:foundBy",
"value": "go-mod-file-cataloger" "value": "go-module-file-cataloger"
}, },
{ {
"name": "syft:package:language", "name": "syft:package:language",

View file

@ -31,7 +31,7 @@
"properties": [ "properties": [
{ {
"name": "syft:package:foundBy", "name": "syft:package:foundBy",
"value": "go-mod-file-cataloger" "value": "go-module-file-cataloger"
}, },
{ {
"name": "syft:package:language", "name": "syft:package:language",

View file

@ -21,7 +21,7 @@
<cpe>cpe:2.3:a:wagoodman:go-partybus:v0.0.0-20230516145632-8ccac152c651:*:*:*:*:*:*:*</cpe> <cpe>cpe:2.3:a:wagoodman:go-partybus:v0.0.0-20230516145632-8ccac152c651:*:*:*:*:*:*:*</cpe>
<purl>pkg:golang/github.com/wagoodman/go-partybus@v0.0.0-20230516145632-8ccac152c651</purl> <purl>pkg:golang/github.com/wagoodman/go-partybus@v0.0.0-20230516145632-8ccac152c651</purl>
<properties> <properties>
<property name="syft:package:foundBy">go-mod-file-cataloger</property> <property name="syft:package:foundBy">go-module-file-cataloger</property>
<property name="syft:package:language">go</property> <property name="syft:package:language">go</property>
<property name="syft:package:metadataType">GolangModMetadata</property> <property name="syft:package:metadataType">GolangModMetadata</property>
<property name="syft:package:type">go-module</property> <property name="syft:package:type">go-module</property>

View file

@ -21,7 +21,7 @@
<cpe>cpe:2.3:a:wagoodman:go-partybus:v0.0.0-20230516145632-8ccac152c651:*:*:*:*:*:*:*</cpe> <cpe>cpe:2.3:a:wagoodman:go-partybus:v0.0.0-20230516145632-8ccac152c651:*:*:*:*:*:*:*</cpe>
<purl>pkg:golang/github.com/wagoodman/go-partybus@v0.0.0-20230516145632-8ccac152c651</purl> <purl>pkg:golang/github.com/wagoodman/go-partybus@v0.0.0-20230516145632-8ccac152c651</purl>
<properties> <properties>
<property name="syft:package:foundBy">go-mod-file-cataloger</property> <property name="syft:package:foundBy">go-module-file-cataloger</property>
<property name="syft:package:language">go</property> <property name="syft:package:language">go</property>
<property name="syft:package:metadataType">GolangModMetadata</property> <property name="syft:package:metadataType">GolangModMetadata</property>
<property name="syft:package:type">go-module</property> <property name="syft:package:type">go-module</property>

View file

@ -21,7 +21,7 @@
<cpe>cpe:2.3:a:wagoodman:go-partybus:v0.0.0-20230516145632-8ccac152c651:*:*:*:*:*:*:*</cpe> <cpe>cpe:2.3:a:wagoodman:go-partybus:v0.0.0-20230516145632-8ccac152c651:*:*:*:*:*:*:*</cpe>
<purl>pkg:golang/github.com/wagoodman/go-partybus@v0.0.0-20230516145632-8ccac152c651</purl> <purl>pkg:golang/github.com/wagoodman/go-partybus@v0.0.0-20230516145632-8ccac152c651</purl>
<properties> <properties>
<property name="syft:package:foundBy">go-mod-file-cataloger</property> <property name="syft:package:foundBy">go-module-file-cataloger</property>
<property name="syft:package:language">go</property> <property name="syft:package:language">go</property>
<property name="syft:package:metadataType">GolangModMetadata</property> <property name="syft:package:metadataType">GolangModMetadata</property>
<property name="syft:package:type">go-module</property> <property name="syft:package:type">go-module</property>

View file

@ -5,7 +5,7 @@
"name": "github.com/wagoodman/go-partybus", "name": "github.com/wagoodman/go-partybus",
"version": "v0.0.0-20230516145632-8ccac152c651", "version": "v0.0.0-20230516145632-8ccac152c651",
"type": "go-module", "type": "go-module",
"foundBy": "go-mod-file-cataloger", "foundBy": "go-module-file-cataloger",
"locations": [ "locations": [
{ {
"path": "/go.mod", "path": "/go.mod",

View file

@ -0,0 +1,15 @@
/*
Package alpine provides a concrete Cataloger implementations for packages relating to the Alpine linux distribution.
*/
package alpine
import (
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger/generic"
)
// NewDBCataloger returns a new cataloger object initialized for Alpine package DB flat-file stores.
func NewDBCataloger() *generic.Cataloger {
return generic.NewCataloger("apk-db-cataloger").
WithParserByGlobs(parseApkDB, pkg.ApkDBGlob)
}

View file

@ -1,4 +1,4 @@
package apkdb package alpine
import ( import (
"testing" "testing"
@ -25,7 +25,7 @@ func TestCataloger_Globs(t *testing.T) {
FromDirectory(t, test.fixture). FromDirectory(t, test.fixture).
ExpectsResolverContentQueries(test.expected). ExpectsResolverContentQueries(test.expected).
IgnoreUnfulfilledPathResponses("etc/apk/repositories"). IgnoreUnfulfilledPathResponses("etc/apk/repositories").
TestCataloger(t, NewApkdbCataloger()) TestCataloger(t, NewDBCataloger())
}) })
} }
} }

View file

@ -1,4 +1,4 @@
package apkdb package alpine
import ( import (
"strings" "strings"

View file

@ -1,4 +1,4 @@
package apkdb package alpine
import ( import (
"strings" "strings"

View file

@ -1,4 +1,4 @@
package apkdb package alpine
import ( import (
"bufio" "bufio"

View file

@ -1,4 +1,4 @@
package apkdb package alpine
import ( import (
"io" "io"

View file

@ -1,14 +0,0 @@
package alpm
import (
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger/generic"
)
const catalogerName = "alpmdb-cataloger"
// NewAlpmdbCataloger returns a new cataloger object initialized for arch linux pacman database flat-file stores.
func NewAlpmdbCataloger() *generic.Cataloger {
return generic.NewCataloger(catalogerName).
WithParserByGlobs(parseAlpmDB, pkg.AlpmDBGlob)
}

View file

@ -1,17 +0,0 @@
/*
Package apkdb provides a concrete Cataloger implementation for Alpine DB files.
*/
package apkdb
import (
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger/generic"
)
const catalogerName = "apkdb-cataloger"
// NewApkdbCataloger returns a new cataloger object initialized for Alpine package DB flat-file stores.
func NewApkdbCataloger() *generic.Cataloger {
return generic.NewCataloger(catalogerName).
WithParserByGlobs(parseApkDB, pkg.ApkDBGlob)
}

View file

@ -0,0 +1,15 @@
/*
Package arch provides a concrete Cataloger implementations for packages relating to the Arch linux distribution.
*/
package arch
import (
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger/generic"
)
// NewDBCataloger returns a new cataloger object initialized for arch linux pacman database flat-file stores.
func NewDBCataloger() *generic.Cataloger {
return generic.NewCataloger("alpm-db-cataloger").
WithParserByGlobs(parseAlpmDB, pkg.AlpmDBGlob)
}

View file

@ -1,4 +1,4 @@
package alpm package arch
import ( import (
"testing" "testing"
@ -18,7 +18,7 @@ func TestAlpmCataloger(t *testing.T) {
Name: "gmp", Name: "gmp",
Version: "6.2.1-2", Version: "6.2.1-2",
Type: pkg.AlpmPkg, Type: pkg.AlpmPkg,
FoundBy: "alpmdb-cataloger", FoundBy: "alpm-db-cataloger",
Licenses: pkg.NewLicenseSet( Licenses: pkg.NewLicenseSet(
pkg.NewLicenseFromLocations("LGPL3", dbLocation), pkg.NewLicenseFromLocations("LGPL3", dbLocation),
pkg.NewLicenseFromLocations("GPL", dbLocation), pkg.NewLicenseFromLocations("GPL", dbLocation),
@ -177,7 +177,7 @@ func TestAlpmCataloger(t *testing.T) {
FromDirectory(t, "test-fixtures/gmp-fixture"). FromDirectory(t, "test-fixtures/gmp-fixture").
WithCompareOptions(cmpopts.IgnoreFields(pkg.AlpmFileRecord{}, "Time")). WithCompareOptions(cmpopts.IgnoreFields(pkg.AlpmFileRecord{}, "Time")).
Expects(expectedPkgs, expectedRelationships). Expects(expectedPkgs, expectedRelationships).
TestCataloger(t, NewAlpmdbCataloger()) TestCataloger(t, NewDBCataloger())
} }
@ -203,7 +203,7 @@ func TestCataloger_Globs(t *testing.T) {
FromDirectory(t, test.fixture). FromDirectory(t, test.fixture).
ExpectsResolverContentQueries(test.expected). ExpectsResolverContentQueries(test.expected).
IgnoreUnfulfilledPathResponses("var/lib/pacman/local/base-1.0/mtree", "var/lib/pacman/local/dive-0.10.0/mtree"). IgnoreUnfulfilledPathResponses("var/lib/pacman/local/base-1.0/mtree", "var/lib/pacman/local/dive-0.10.0/mtree").
TestCataloger(t, NewAlpmdbCataloger()) TestCataloger(t, NewDBCataloger())
}) })
} }
} }

View file

@ -1,4 +1,4 @@
package alpm package arch
import ( import (
"strings" "strings"

View file

@ -1,4 +1,4 @@
package alpm package arch
import ( import (
"testing" "testing"

View file

@ -1,4 +1,4 @@
package alpm package arch
import ( import (
"bufio" "bufio"

View file

@ -1,4 +1,4 @@
package alpm package arch
import ( import (
"bufio" "bufio"

View file

@ -1,3 +1,6 @@
/*
Package binary provides a concrete Cataloger implementations for surfacing possible packages based on signatures found within binary files.
*/
package binary package binary
import ( import (

View file

@ -10,15 +10,16 @@ import (
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger/alpm" "github.com/anchore/syft/syft/pkg/cataloger/alpine"
"github.com/anchore/syft/syft/pkg/cataloger/apkdb" "github.com/anchore/syft/syft/pkg/cataloger/arch"
"github.com/anchore/syft/syft/pkg/cataloger/binary" "github.com/anchore/syft/syft/pkg/cataloger/binary"
"github.com/anchore/syft/syft/pkg/cataloger/cpp" "github.com/anchore/syft/syft/pkg/cataloger/cpp"
"github.com/anchore/syft/syft/pkg/cataloger/dart" "github.com/anchore/syft/syft/pkg/cataloger/dart"
"github.com/anchore/syft/syft/pkg/cataloger/deb" "github.com/anchore/syft/syft/pkg/cataloger/debian"
"github.com/anchore/syft/syft/pkg/cataloger/dotnet" "github.com/anchore/syft/syft/pkg/cataloger/dotnet"
"github.com/anchore/syft/syft/pkg/cataloger/elixir" "github.com/anchore/syft/syft/pkg/cataloger/elixir"
"github.com/anchore/syft/syft/pkg/cataloger/erlang" "github.com/anchore/syft/syft/pkg/cataloger/erlang"
"github.com/anchore/syft/syft/pkg/cataloger/gentoo"
"github.com/anchore/syft/syft/pkg/cataloger/githubactions" "github.com/anchore/syft/syft/pkg/cataloger/githubactions"
"github.com/anchore/syft/syft/pkg/cataloger/golang" "github.com/anchore/syft/syft/pkg/cataloger/golang"
"github.com/anchore/syft/syft/pkg/cataloger/haskell" "github.com/anchore/syft/syft/pkg/cataloger/haskell"
@ -27,10 +28,9 @@ import (
"github.com/anchore/syft/syft/pkg/cataloger/kernel" "github.com/anchore/syft/syft/pkg/cataloger/kernel"
"github.com/anchore/syft/syft/pkg/cataloger/nix" "github.com/anchore/syft/syft/pkg/cataloger/nix"
"github.com/anchore/syft/syft/pkg/cataloger/php" "github.com/anchore/syft/syft/pkg/cataloger/php"
"github.com/anchore/syft/syft/pkg/cataloger/portage"
"github.com/anchore/syft/syft/pkg/cataloger/python" "github.com/anchore/syft/syft/pkg/cataloger/python"
"github.com/anchore/syft/syft/pkg/cataloger/r" "github.com/anchore/syft/syft/pkg/cataloger/r"
"github.com/anchore/syft/syft/pkg/cataloger/rpm" "github.com/anchore/syft/syft/pkg/cataloger/redhat"
"github.com/anchore/syft/syft/pkg/cataloger/ruby" "github.com/anchore/syft/syft/pkg/cataloger/ruby"
"github.com/anchore/syft/syft/pkg/cataloger/rust" "github.com/anchore/syft/syft/pkg/cataloger/rust"
"github.com/anchore/syft/syft/pkg/cataloger/sbom" "github.com/anchore/syft/syft/pkg/cataloger/sbom"
@ -42,61 +42,61 @@ const AllCatalogersPattern = "all"
// ImageCatalogers returns a slice of locally implemented catalogers that are fit for detecting installations of packages. // ImageCatalogers returns a slice of locally implemented catalogers that are fit for detecting installations of packages.
func ImageCatalogers(cfg Config) []pkg.Cataloger { func ImageCatalogers(cfg Config) []pkg.Cataloger {
return filterCatalogers([]pkg.Cataloger{ return filterCatalogers([]pkg.Cataloger{
alpm.NewAlpmdbCataloger(), arch.NewDBCataloger(),
apkdb.NewApkdbCataloger(), alpine.NewDBCataloger(),
binary.NewCataloger(), binary.NewCataloger(),
cpp.NewConanInfoCataloger(), cpp.NewConanInfoCataloger(),
deb.NewDpkgdbCataloger(), debian.NewDBCataloger(),
dotnet.NewDotnetPortableExecutableCataloger(), dotnet.NewDotnetPortableExecutableCataloger(),
golang.NewGoModuleBinaryCataloger(cfg.Golang), golang.NewGoModuleBinaryCataloger(cfg.Golang),
java.NewJavaCataloger(cfg.JavaConfig()), java.NewArchiveCataloger(cfg.JavaConfig()),
java.NewNativeImageCataloger(), java.NewNativeImageCataloger(),
javascript.NewPackageCataloger(), javascript.NewPackageCataloger(),
nix.NewStoreCataloger(), nix.NewStoreCataloger(),
php.NewComposerInstalledCataloger(), php.NewComposerInstalledCataloger(),
portage.NewPortageCataloger(), gentoo.NewPortageCataloger(),
python.NewPythonPackageCataloger(), python.NewInstalledPackageCataloger(),
r.NewPackageCataloger(), r.NewPackageCataloger(),
rpm.NewRpmDBCataloger(), redhat.NewDBCataloger(),
ruby.NewInstalledGemSpecCataloger(), ruby.NewInstalledGemSpecCataloger(),
sbom.NewSBOMCataloger(), sbom.NewCataloger(),
}, cfg.Catalogers) }, cfg.Catalogers)
} }
// DirectoryCatalogers returns a slice of locally implemented catalogers that are fit for detecting packages from index files (and select installations) // DirectoryCatalogers returns a slice of locally implemented catalogers that are fit for detecting packages from index files (and select installations)
func DirectoryCatalogers(cfg Config) []pkg.Cataloger { func DirectoryCatalogers(cfg Config) []pkg.Cataloger {
return filterCatalogers([]pkg.Cataloger{ return filterCatalogers([]pkg.Cataloger{
alpm.NewAlpmdbCataloger(), arch.NewDBCataloger(),
apkdb.NewApkdbCataloger(), alpine.NewDBCataloger(),
binary.NewCataloger(), binary.NewCataloger(),
cpp.NewConanCataloger(), cpp.NewConanCataloger(),
dart.NewPubspecLockCataloger(), dart.NewPubspecLockCataloger(),
deb.NewDpkgdbCataloger(), debian.NewDBCataloger(),
dotnet.NewDotnetDepsCataloger(), dotnet.NewDotnetDepsCataloger(),
dotnet.NewDotnetPortableExecutableCataloger(), dotnet.NewDotnetPortableExecutableCataloger(),
elixir.NewMixLockCataloger(), elixir.NewMixLockCataloger(),
erlang.NewRebarLockCataloger(), erlang.NewRebarLockCataloger(),
githubactions.NewActionUsageCataloger(), githubactions.NewActionUsageCataloger(),
githubactions.NewWorkflowUsageCataloger(), githubactions.NewWorkflowUsageCataloger(),
golang.NewGoModFileCataloger(cfg.Golang), golang.NewGoModuleFileCataloger(cfg.Golang),
golang.NewGoModuleBinaryCataloger(cfg.Golang), golang.NewGoModuleBinaryCataloger(cfg.Golang),
haskell.NewHackageCataloger(), haskell.NewHackageCataloger(),
java.NewJavaCataloger(cfg.JavaConfig()), java.NewArchiveCataloger(cfg.JavaConfig()),
java.NewJavaGradleLockfileCataloger(), java.NewGradleLockfileCataloger(),
java.NewJavaPomCataloger(), java.NewPomCataloger(),
java.NewNativeImageCataloger(), java.NewNativeImageCataloger(),
javascript.NewLockCataloger(), javascript.NewLockCataloger(),
nix.NewStoreCataloger(), nix.NewStoreCataloger(),
php.NewComposerLockCataloger(), php.NewComposerLockCataloger(),
portage.NewPortageCataloger(), gentoo.NewPortageCataloger(),
python.NewPythonIndexCataloger(cfg.Python), python.NewPackageCataloger(cfg.Python),
python.NewPythonPackageCataloger(), python.NewInstalledPackageCataloger(),
rpm.NewFileCataloger(), redhat.NewArchiveCataloger(),
rpm.NewRpmDBCataloger(), redhat.NewDBCataloger(),
ruby.NewGemFileLockCataloger(), ruby.NewGemFileLockCataloger(),
ruby.NewGemSpecCataloger(), ruby.NewGemSpecCataloger(),
rust.NewCargoLockCataloger(), rust.NewCargoLockCataloger(),
sbom.NewSBOMCataloger(), sbom.NewCataloger(),
swift.NewCocoapodsCataloger(), swift.NewCocoapodsCataloger(),
swift.NewSwiftPackageManagerCataloger(), swift.NewSwiftPackageManagerCataloger(),
}, cfg.Catalogers) }, cfg.Catalogers)
@ -105,24 +105,24 @@ func DirectoryCatalogers(cfg Config) []pkg.Cataloger {
// AllCatalogers returns all implemented catalogers // AllCatalogers returns all implemented catalogers
func AllCatalogers(cfg Config) []pkg.Cataloger { func AllCatalogers(cfg Config) []pkg.Cataloger {
return filterCatalogers([]pkg.Cataloger{ return filterCatalogers([]pkg.Cataloger{
alpm.NewAlpmdbCataloger(), arch.NewDBCataloger(),
apkdb.NewApkdbCataloger(), alpine.NewDBCataloger(),
binary.NewCataloger(), binary.NewCataloger(),
cpp.NewConanCataloger(), cpp.NewConanCataloger(),
dart.NewPubspecLockCataloger(), dart.NewPubspecLockCataloger(),
deb.NewDpkgdbCataloger(), debian.NewDBCataloger(),
dotnet.NewDotnetDepsCataloger(), dotnet.NewDotnetDepsCataloger(),
dotnet.NewDotnetPortableExecutableCataloger(), dotnet.NewDotnetPortableExecutableCataloger(),
elixir.NewMixLockCataloger(), elixir.NewMixLockCataloger(),
erlang.NewRebarLockCataloger(), erlang.NewRebarLockCataloger(),
githubactions.NewActionUsageCataloger(), githubactions.NewActionUsageCataloger(),
githubactions.NewWorkflowUsageCataloger(), githubactions.NewWorkflowUsageCataloger(),
golang.NewGoModFileCataloger(cfg.Golang), golang.NewGoModuleFileCataloger(cfg.Golang),
golang.NewGoModuleBinaryCataloger(cfg.Golang), golang.NewGoModuleBinaryCataloger(cfg.Golang),
haskell.NewHackageCataloger(), haskell.NewHackageCataloger(),
java.NewJavaCataloger(cfg.JavaConfig()), java.NewArchiveCataloger(cfg.JavaConfig()),
java.NewJavaGradleLockfileCataloger(), java.NewGradleLockfileCataloger(),
java.NewJavaPomCataloger(), java.NewPomCataloger(),
java.NewNativeImageCataloger(), java.NewNativeImageCataloger(),
javascript.NewLockCataloger(), javascript.NewLockCataloger(),
javascript.NewPackageCataloger(), javascript.NewPackageCataloger(),
@ -130,18 +130,18 @@ func AllCatalogers(cfg Config) []pkg.Cataloger {
nix.NewStoreCataloger(), nix.NewStoreCataloger(),
php.NewComposerInstalledCataloger(), php.NewComposerInstalledCataloger(),
php.NewComposerLockCataloger(), php.NewComposerLockCataloger(),
portage.NewPortageCataloger(), gentoo.NewPortageCataloger(),
python.NewPythonIndexCataloger(cfg.Python), python.NewPackageCataloger(cfg.Python),
python.NewPythonPackageCataloger(), python.NewInstalledPackageCataloger(),
r.NewPackageCataloger(), r.NewPackageCataloger(),
rpm.NewFileCataloger(), redhat.NewArchiveCataloger(),
rpm.NewRpmDBCataloger(), redhat.NewDBCataloger(),
ruby.NewGemFileLockCataloger(), ruby.NewGemFileLockCataloger(),
ruby.NewGemSpecCataloger(), ruby.NewGemSpecCataloger(),
ruby.NewInstalledGemSpecCataloger(), ruby.NewInstalledGemSpecCataloger(),
rust.NewAuditBinaryCataloger(), rust.NewAuditBinaryCataloger(),
rust.NewCargoLockCataloger(), rust.NewCargoLockCataloger(),
sbom.NewSBOMCataloger(), sbom.NewCataloger(),
swift.NewCocoapodsCataloger(), swift.NewCocoapodsCataloger(),
swift.NewSwiftPackageManagerCataloger(), swift.NewSwiftPackageManagerCataloger(),
}, cfg.Catalogers) }, cfg.Catalogers)

View file

@ -26,16 +26,16 @@ func (d dummy) Catalog(_ file.Resolver) ([]pkg.Package, []artifact.Relationship,
func Test_filterCatalogers(t *testing.T) { func Test_filterCatalogers(t *testing.T) {
largeCatalogerList := []string{ largeCatalogerList := []string{
"alpmdb-cataloger", "alpm-db-cataloger",
"apkdb-cataloger", "apkdb-cataloger",
"binary-cataloger", "binary-cataloger",
"conan-cataloger", "conan-cataloger",
"dartlang-lock-cataloger", "dartlang-lock-cataloger",
"dpkgdb-cataloger", "dpkg-db-cataloger",
"dotnet-deps-cataloger", "dotnet-deps-cataloger",
"elixir-mix-lock-cataloger", "elixir-mix-lock-cataloger",
"erlang-rebar-lock-cataloger", "erlang-rebar-lock-cataloger",
"go-mod-file-cataloger", "go-module-file-cataloger",
"go-module-binary-cataloger", "go-module-binary-cataloger",
"haskell-cataloger", "haskell-cataloger",
"graalvm-native-image-cataloger", "graalvm-native-image-cataloger",
@ -46,12 +46,12 @@ func Test_filterCatalogers(t *testing.T) {
"php-composer-installed-cataloger", "php-composer-installed-cataloger",
"php-composer-lock-cataloger", "php-composer-lock-cataloger",
"portage-cataloger", "portage-cataloger",
"python-index-cataloger",
"python-package-cataloger", "python-package-cataloger",
"python-installed-package-cataloger",
"rpm-db-cataloger", "rpm-db-cataloger",
"rpm-file-cataloger", "rpm-archive-cataloger",
"ruby-gemfile-cataloger", "ruby-gemfile-cataloger",
"ruby-gemspec-cataloger", "ruby-installed-gemspec-cataloger",
"rust-cargo-lock-cataloger", "rust-cargo-lock-cataloger",
"cargo-auditable-binary-cataloger", "cargo-auditable-binary-cataloger",
"sbom-cataloger", "sbom-cataloger",
@ -67,23 +67,23 @@ func Test_filterCatalogers(t *testing.T) {
name: "no filtering", name: "no filtering",
patterns: nil, patterns: nil,
catalogers: []string{ catalogers: []string{
"ruby-gemspec-cataloger", "ruby-installed-gemspec-cataloger",
"python-package-cataloger", "python-installed-package-cataloger",
"php-composer-installed-cataloger", "php-composer-installed-cataloger",
"javascript-package-cataloger", "javascript-package-cataloger",
"dpkgdb-cataloger", "dpkg-db-cataloger",
"rpmdb-cataloger", "rpm-db-cataloger",
"java-cataloger", "java-cataloger",
"apkdb-cataloger", "apkdb-cataloger",
"go-module-binary-cataloger", "go-module-binary-cataloger",
}, },
want: []string{ want: []string{
"ruby-gemspec-cataloger", "ruby-installed-gemspec-cataloger",
"python-package-cataloger", "python-installed-package-cataloger",
"php-composer-installed-cataloger", "php-composer-installed-cataloger",
"javascript-package-cataloger", "javascript-package-cataloger",
"dpkgdb-cataloger", "dpkg-db-cataloger",
"rpmdb-cataloger", "rpm-db-cataloger",
"java-cataloger", "java-cataloger",
"apkdb-cataloger", "apkdb-cataloger",
"go-module-binary-cataloger", "go-module-binary-cataloger",
@ -92,23 +92,23 @@ func Test_filterCatalogers(t *testing.T) {
{ {
name: "exact name match", name: "exact name match",
patterns: []string{ patterns: []string{
"rpmdb-cataloger", "rpm-db-cataloger",
"javascript-package-cataloger", "javascript-package-cataloger",
}, },
catalogers: []string{ catalogers: []string{
"ruby-gemspec-cataloger", "ruby-installed-gemspec-cataloger",
"python-package-cataloger", "python-installed-package-cataloger",
"php-composer-installed-cataloger", "php-composer-installed-cataloger",
"javascript-package-cataloger", "javascript-package-cataloger",
"dpkgdb-cataloger", "dpkg-db-cataloger",
"rpmdb-cataloger", "rpm-db-cataloger",
"java-cataloger", "java-cataloger",
"apkdb-cataloger", "apkdb-cataloger",
"go-module-binary-cataloger", "go-module-binary-cataloger",
}, },
want: []string{ want: []string{
"javascript-package-cataloger", "javascript-package-cataloger",
"rpmdb-cataloger", "rpm-db-cataloger",
}, },
}, },
{ {
@ -118,20 +118,21 @@ func Test_filterCatalogers(t *testing.T) {
"installed", "installed",
}, },
catalogers: []string{ catalogers: []string{
"ruby-gemspec-cataloger", "ruby-installed-gemspec-cataloger",
"ruby-gemfile-cataloger", "ruby-gemfile-cataloger",
"python-package-cataloger", "python-installed-package-cataloger",
"php-composer-installed-cataloger", "php-composer-installed-cataloger",
"javascript-package-cataloger", "javascript-package-cataloger",
"dpkgdb-cataloger", "dpkg-db-cataloger",
"rpmdb-cataloger", "rpm-db-cataloger",
"java-cataloger", "java-cataloger",
"apkdb-cataloger", "apkdb-cataloger",
"go-module-binary-cataloger", "go-module-binary-cataloger",
}, },
want: []string{ want: []string{
"php-composer-installed-cataloger", "php-composer-installed-cataloger",
"ruby-gemspec-cataloger", "python-installed-package-cataloger",
"ruby-installed-gemspec-cataloger",
"ruby-gemfile-cataloger", "ruby-gemfile-cataloger",
}, },
}, },
@ -141,13 +142,13 @@ func Test_filterCatalogers(t *testing.T) {
"cataloger", "cataloger",
}, },
catalogers: []string{ catalogers: []string{
"ruby-gemspec-cataloger", "ruby-installed-gemspec-cataloger",
"ruby-gemfile-cataloger", "ruby-gemfile-cataloger",
"python-package-cataloger", "python-installed-package-cataloger",
"php-composer-installed-cataloger", "php-composer-installed-cataloger",
"javascript-package-cataloger", "javascript-package-cataloger",
"dpkgdb-cataloger", "dpkg-db-cataloger",
"rpmdb-cataloger", "rpm-db-cataloger",
"java-cataloger", "java-cataloger",
"apkdb-cataloger", "apkdb-cataloger",
"go-module-binary-cataloger", "go-module-binary-cataloger",
@ -161,13 +162,13 @@ func Test_filterCatalogers(t *testing.T) {
"go-module", "go-module",
}, },
catalogers: []string{ catalogers: []string{
"ruby-gemspec-cataloger", "ruby-installed-gemspec-cataloger",
"ruby-gemfile-cataloger", "ruby-gemfile-cataloger",
"python-package-cataloger", "python-installed-package-cataloger",
"php-composer-installed-cataloger", "php-composer-installed-cataloger",
"javascript-package-cataloger", "javascript-package-cataloger",
"dpkgdb-cataloger", "dpkg-db-cataloger",
"rpmdb-cataloger", "rpm-db-cataloger",
"java-cataloger", "java-cataloger",
"apkdb-cataloger", "apkdb-cataloger",
"go-module-binary-cataloger", "go-module-binary-cataloger",
@ -196,7 +197,7 @@ func Test_filterCatalogers(t *testing.T) {
}, },
catalogers: largeCatalogerList, catalogers: largeCatalogerList,
want: []string{ want: []string{
"go-mod-file-cataloger", "go-module-file-cataloger",
"go-module-binary-cataloger", "go-module-binary-cataloger",
//"rust-cargo-lock-cataloger", // with naive "contains" matching //"rust-cargo-lock-cataloger", // with naive "contains" matching
//"cargo-auditable-binary-cataloger", // with naive "contains" matching //"cargo-auditable-binary-cataloger", // with naive "contains" matching
@ -209,8 +210,9 @@ func Test_filterCatalogers(t *testing.T) {
}, },
catalogers: largeCatalogerList, catalogers: largeCatalogerList,
want: []string{ want: []string{
"go-mod-file-cataloger", // important! these are NOT found
//"go-module-binary-cataloger", // unfortunately not a full word (this should probably be renamed) //"go-module-file-cataloger",
//"go-module-binary-cataloger",
}, },
}, },
} }
@ -250,7 +252,7 @@ func Test_contains(t *testing.T) {
enabledCatalogers: []string{ enabledCatalogers: []string{
"python", "python",
}, },
catalogerName: "python-package-cataloger", catalogerName: "python-installed-package-cataloger",
want: true, want: true,
}, },
{ {
@ -258,7 +260,7 @@ func Test_contains(t *testing.T) {
enabledCatalogers: []string{ enabledCatalogers: []string{
"cataloger", "cataloger",
}, },
catalogerName: "python-package-cataloger", catalogerName: "python-installed-package-cataloger",
want: false, want: false,
}, },
} }

View file

@ -1,3 +1,6 @@
/*
Package cpp provides a concrete Cataloger implementations for the C/C++ language ecosystem.
*/
package cpp package cpp
import ( import (

View file

@ -1,13 +1,14 @@
/*
Package dart provides a concrete Cataloger implementations for the Dart language ecosystem.
*/
package dart package dart
import ( import (
"github.com/anchore/syft/syft/pkg/cataloger/generic" "github.com/anchore/syft/syft/pkg/cataloger/generic"
) )
const catalogerName = "dartlang-lock-cataloger"
// NewPubspecLockCataloger returns a new Dartlang cataloger object base on pubspec lock files. // NewPubspecLockCataloger returns a new Dartlang cataloger object base on pubspec lock files.
func NewPubspecLockCataloger() *generic.Cataloger { func NewPubspecLockCataloger() *generic.Cataloger {
return generic.NewCataloger(catalogerName). return generic.NewCataloger("dart-pubspec-lock-cataloger").
WithParserByGlobs(parsePubspecLock, "**/pubspec.lock") WithParserByGlobs(parsePubspecLock, "**/pubspec.lock")
} }

View file

@ -1,17 +1,15 @@
/* /*
Package deb provides a concrete Cataloger implementation for Debian package DB status files. Package debian provides a concrete Cataloger implementation relating to packages within the Debian linux distribution.
*/ */
package deb package debian
import ( import (
"github.com/anchore/syft/syft/pkg/cataloger/generic" "github.com/anchore/syft/syft/pkg/cataloger/generic"
) )
const catalogerName = "dpkgdb-cataloger" // NewDBCataloger returns a new Deb package cataloger capable of parsing DPKG status DB flat-file stores.
func NewDBCataloger() *generic.Cataloger {
// NewDpkgdbCataloger returns a new Deb package cataloger capable of parsing DPKG status DB flat-file stores. return generic.NewCataloger("dpkg-db-cataloger").
func NewDpkgdbCataloger() *generic.Cataloger {
return generic.NewCataloger(catalogerName).
// note: these globs have been intentionally split up in order to improve search performance, // note: these globs have been intentionally split up in order to improve search performance,
// please do NOT combine into: "**/var/lib/dpkg/{status,status.d/*}" // please do NOT combine into: "**/var/lib/dpkg/{status,status.d/*}"
WithParserByGlobs(parseDpkgDB, "**/var/lib/dpkg/status", "**/var/lib/dpkg/status.d/*", "**/lib/opkg/info/*.control", "**/lib/opkg/status") WithParserByGlobs(parseDpkgDB, "**/var/lib/dpkg/status", "**/var/lib/dpkg/status.d/*", "**/lib/opkg/info/*.control", "**/lib/opkg/status")

View file

@ -1,4 +1,4 @@
package deb package debian
import ( import (
"testing" "testing"
@ -19,7 +19,7 @@ func TestDpkgCataloger(t *testing.T) {
{ {
Name: "libpam-runtime", Name: "libpam-runtime",
Version: "1.1.8-3.6", Version: "1.1.8-3.6",
FoundBy: "dpkgdb-cataloger", FoundBy: "dpkg-db-cataloger",
Licenses: pkg.NewLicenseSet( Licenses: pkg.NewLicenseSet(
pkg.NewLicenseFromLocations("GPL-1", file.NewVirtualLocation("/usr/share/doc/libpam-runtime/copyright", "/usr/share/doc/libpam-runtime/copyright")), pkg.NewLicenseFromLocations("GPL-1", file.NewVirtualLocation("/usr/share/doc/libpam-runtime/copyright", "/usr/share/doc/libpam-runtime/copyright")),
pkg.NewLicenseFromLocations("GPL-2", file.NewVirtualLocation("/usr/share/doc/libpam-runtime/copyright", "/usr/share/doc/libpam-runtime/copyright")), pkg.NewLicenseFromLocations("GPL-2", file.NewVirtualLocation("/usr/share/doc/libpam-runtime/copyright", "/usr/share/doc/libpam-runtime/copyright")),
@ -92,7 +92,7 @@ func TestDpkgCataloger(t *testing.T) {
{ {
Name: "libsqlite3-0", Name: "libsqlite3-0",
Version: "3.34.1-3", Version: "3.34.1-3",
FoundBy: "dpkgdb-cataloger", FoundBy: "dpkg-db-cataloger",
Licenses: pkg.NewLicenseSet( Licenses: pkg.NewLicenseSet(
pkg.NewLicenseFromLocations("public-domain", file.NewVirtualLocation("/usr/share/doc/libsqlite3-0/copyright", "/usr/share/doc/libsqlite3-0/copyright")), pkg.NewLicenseFromLocations("public-domain", file.NewVirtualLocation("/usr/share/doc/libsqlite3-0/copyright", "/usr/share/doc/libsqlite3-0/copyright")),
pkg.NewLicenseFromLocations("GPL-2+", file.NewVirtualLocation("/usr/share/doc/libsqlite3-0/copyright", "/usr/share/doc/libsqlite3-0/copyright")), pkg.NewLicenseFromLocations("GPL-2+", file.NewVirtualLocation("/usr/share/doc/libsqlite3-0/copyright", "/usr/share/doc/libsqlite3-0/copyright")),
@ -150,7 +150,7 @@ func TestDpkgCataloger(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
c := NewDpkgdbCataloger() c := NewDBCataloger()
pkgtest.NewCatalogTester(). pkgtest.NewCatalogTester().
WithImageResolver(t, tt.name). WithImageResolver(t, tt.name).
IgnoreLocationLayer(). // this fixture can be rebuilt, thus the layer ID will change IgnoreLocationLayer(). // this fixture can be rebuilt, thus the layer ID will change
@ -183,7 +183,7 @@ func TestCataloger_Globs(t *testing.T) {
pkgtest.NewCatalogTester(). pkgtest.NewCatalogTester().
FromDirectory(t, test.fixture). FromDirectory(t, test.fixture).
ExpectsResolverContentQueries(test.expected). ExpectsResolverContentQueries(test.expected).
TestCataloger(t, NewDpkgdbCataloger()) TestCataloger(t, NewDBCataloger())
}) })
} }
} }

View file

@ -1,4 +1,4 @@
package deb package debian
import ( import (
"fmt" "fmt"

View file

@ -1,4 +1,4 @@
package deb package debian
import ( import (
"testing" "testing"

View file

@ -1,4 +1,4 @@
package deb package debian
import ( import (
"bufio" "bufio"

View file

@ -1,4 +1,4 @@
package deb package debian
import ( import (
"os" "os"

View file

@ -1,4 +1,4 @@
package deb package debian
import ( import (
"bufio" "bufio"

View file

@ -1,4 +1,4 @@
package deb package debian
import ( import (
"bufio" "bufio"

View file

@ -1,4 +1,4 @@
package deb package debian
import ( import (
"bufio" "bufio"

View file

@ -1,4 +1,4 @@
package deb package debian
import ( import (
"os" "os"

View file

@ -1,3 +1,6 @@
/*
Package dotnet provides a concrete Cataloger implementation relating to packages within the C#/.NET language/runtime ecosystem.
*/
package dotnet package dotnet
import ( import (

View file

@ -1,5 +1,5 @@
/* /*
Package elixir provides a concrete Cataloger implementation for elixir specific package manger files. Package elixir provides a concrete Cataloger implementation relating to packages within the Elixir language ecosystem.
*/ */
package elixir package elixir
@ -7,10 +7,8 @@ import (
"github.com/anchore/syft/syft/pkg/cataloger/generic" "github.com/anchore/syft/syft/pkg/cataloger/generic"
) )
const catalogerName = "elixir-mix-lock-cataloger"
// NewMixLockCataloger returns a cataloger object for Elixir mix.lock files. // NewMixLockCataloger returns a cataloger object for Elixir mix.lock files.
func NewMixLockCataloger() *generic.Cataloger { func NewMixLockCataloger() *generic.Cataloger {
return generic.NewCataloger(catalogerName). return generic.NewCataloger("elixir-mix-lock-cataloger").
WithParserByGlobs(parseMixLock, "**/mix.lock") WithParserByGlobs(parseMixLock, "**/mix.lock")
} }

View file

@ -1,5 +1,5 @@
/* /*
Package erlang provides a concrete Cataloger implementation for erlang specific package manger files. Package erlang provides a concrete Cataloger implementation relating to packages within the Erlang language ecosystem.
*/ */
package erlang package erlang
@ -7,10 +7,8 @@ import (
"github.com/anchore/syft/syft/pkg/cataloger/generic" "github.com/anchore/syft/syft/pkg/cataloger/generic"
) )
const catalogerName = "erlang-rebar-lock-cataloger"
// NewRebarLockCataloger returns a new cataloger instance for Erlang rebar.lock files. // NewRebarLockCataloger returns a new cataloger instance for Erlang rebar.lock files.
func NewRebarLockCataloger() *generic.Cataloger { func NewRebarLockCataloger() *generic.Cataloger {
return generic.NewCataloger(catalogerName). return generic.NewCataloger("erlang-rebar-lock-cataloger").
WithParserByGlobs(parseRebarLock, "**/rebar.lock") WithParserByGlobs(parseRebarLock, "**/rebar.lock")
} }

View file

@ -1,7 +1,7 @@
/* /*
Package portage provides a concrete Cataloger implementation for Gentoo Portage. Package gentoo provides a concrete Cataloger implementation related to packages within the Gentoo linux ecosystem.
*/ */
package portage package gentoo
import ( import (
"github.com/anchore/syft/syft/pkg/cataloger/generic" "github.com/anchore/syft/syft/pkg/cataloger/generic"

View file

@ -1,4 +1,4 @@
package portage package gentoo
import ( import (
"testing" "testing"

View file

@ -1,4 +1,4 @@
package portage package gentoo
import ( import (
"bufio" "bufio"

View file

@ -1,4 +1,4 @@
package portage package gentoo
import ( import (
"github.com/anchore/packageurl-go" "github.com/anchore/packageurl-go"

View file

@ -1,4 +1,4 @@
package portage package gentoo
import ( import (
"fmt" "fmt"

View file

@ -1,3 +1,6 @@
/*
Package githubactions provides a concrete Cataloger implementation for GitHub Actions packages (both actions and workflows).
*/
package githubactions package githubactions
import "github.com/anchore/syft/syft/pkg/cataloger/generic" import "github.com/anchore/syft/syft/pkg/cataloger/generic"

View file

@ -42,8 +42,8 @@ jobs:
- name: Restore RPM test-fixture cache - name: Restore RPM test-fixture cache
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: syft/pkg/cataloger/rpm/test-fixtures/rpms path: syft/pkg/cataloger/redhat/test-fixtures/rpms
key: ${{ runner.os }}-unit-rpm-cache-${{ hashFiles( 'syft/pkg/cataloger/rpm/test-fixtures/rpms.fingerprint' ) }} key: ${{ runner.os }}-unit-rpm-cache-${{ hashFiles( 'syft/pkg/cataloger/redhat/test-fixtures/rpms.fingerprint' ) }}
- name: Restore go binary test-fixture cache - name: Restore go binary test-fixture cache
uses: actions/cache@v3 uses: actions/cache@v3

View file

@ -1,5 +1,5 @@
/* /*
Package golang provides a concrete Cataloger implementation for go.mod files. Package golang provides a concrete Cataloger implementation relating to packages within the Go language ecosystem.
*/ */
package golang package golang
@ -19,14 +19,14 @@ import (
var versionCandidateGroups = regexp.MustCompile(`(?P<version>\d+(\.\d+)?(\.\d+)?)(?P<candidate>\w*)`) var versionCandidateGroups = regexp.MustCompile(`(?P<version>\d+(\.\d+)?(\.\d+)?)(?P<candidate>\w*)`)
// NewGoModFileCataloger returns a new cataloger object that searches within go.mod files. // NewGoModuleFileCataloger returns a new cataloger object that searches within go.mod files.
func NewGoModFileCataloger(opts GoCatalogerOpts) pkg.Cataloger { func NewGoModuleFileCataloger(opts GoCatalogerOpts) pkg.Cataloger {
c := goModCataloger{ c := goModCataloger{
licenses: newGoLicenses(opts), licenses: newGoLicenses(opts),
} }
return &progressingCataloger{ return &progressingCataloger{
progress: c.licenses.progress, progress: c.licenses.progress,
cataloger: generic.NewCataloger("go-mod-file-cataloger"). cataloger: generic.NewCataloger("go-module-file-cataloger").
WithParserByGlobs(c.parseGoModFile, "**/go.mod"), WithParserByGlobs(c.parseGoModFile, "**/go.mod"),
} }
} }

View file

@ -30,7 +30,7 @@ func Test_Mod_Cataloger_Globs(t *testing.T) {
FromDirectory(t, test.fixture). FromDirectory(t, test.fixture).
ExpectsResolverContentQueries(test.expected). ExpectsResolverContentQueries(test.expected).
IgnoreUnfulfilledPathResponses("src/go.sum"). IgnoreUnfulfilledPathResponses("src/go.sum").
TestCataloger(t, NewGoModFileCataloger(GoCatalogerOpts{})) TestCataloger(t, NewGoModuleFileCataloger(GoCatalogerOpts{}))
}) })
} }
} }

View file

@ -104,7 +104,7 @@ func Test_GoSumHashes(t *testing.T) {
Version: "v0.6.0", Version: "v0.6.0",
PURL: "pkg:golang/github.com/CycloneDX/cyclonedx-go@v0.6.0", PURL: "pkg:golang/github.com/CycloneDX/cyclonedx-go@v0.6.0",
Locations: file.NewLocationSet(file.NewLocation("go.mod")), Locations: file.NewLocationSet(file.NewLocation("go.mod")),
FoundBy: "go-mod-file-cataloger", FoundBy: "go-module-file-cataloger",
Language: pkg.Go, Language: pkg.Go,
Type: pkg.GoModulePkg, Type: pkg.GoModulePkg,
Metadata: pkg.GolangModuleEntry{}, Metadata: pkg.GolangModuleEntry{},
@ -114,7 +114,7 @@ func Test_GoSumHashes(t *testing.T) {
Version: "v0.0.0-20180116102854-5a71ef0e047d", Version: "v0.0.0-20180116102854-5a71ef0e047d",
PURL: "pkg:golang/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d", PURL: "pkg:golang/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d",
Locations: file.NewLocationSet(file.NewLocation("go.mod")), Locations: file.NewLocationSet(file.NewLocation("go.mod")),
FoundBy: "go-mod-file-cataloger", FoundBy: "go-module-file-cataloger",
Language: pkg.Go, Language: pkg.Go,
Type: pkg.GoModulePkg, Type: pkg.GoModulePkg,
Metadata: pkg.GolangModuleEntry{ Metadata: pkg.GolangModuleEntry{
@ -126,7 +126,7 @@ func Test_GoSumHashes(t *testing.T) {
Version: "v0.0.0-20200706080929-d51e80ef957d", Version: "v0.0.0-20200706080929-d51e80ef957d",
PURL: "pkg:golang/github.com/mgutz/ansi@v0.0.0-20200706080929-d51e80ef957d", PURL: "pkg:golang/github.com/mgutz/ansi@v0.0.0-20200706080929-d51e80ef957d",
Locations: file.NewLocationSet(file.NewLocation("go.mod")), Locations: file.NewLocationSet(file.NewLocation("go.mod")),
FoundBy: "go-mod-file-cataloger", FoundBy: "go-module-file-cataloger",
Language: pkg.Go, Language: pkg.Go,
Type: pkg.GoModulePkg, Type: pkg.GoModulePkg,
Metadata: pkg.GolangModuleEntry{ Metadata: pkg.GolangModuleEntry{
@ -142,7 +142,7 @@ func Test_GoSumHashes(t *testing.T) {
pkgtest.NewCatalogTester(). pkgtest.NewCatalogTester().
FromDirectory(t, test.fixture). FromDirectory(t, test.fixture).
Expects(test.expected, nil). Expects(test.expected, nil).
TestCataloger(t, NewGoModFileCataloger(GoCatalogerOpts{})) TestCataloger(t, NewGoModuleFileCataloger(GoCatalogerOpts{}))
}) })
} }
} }

Some files were not shown because too many files have changed in this diff Show more