Skip to content

Commit

Permalink
feat: add traefik classifier (#1504)
Browse files Browse the repository at this point in the history
Signed-off-by: witchcraze <witchcraze@gmail.com>
  • Loading branch information
witchcraze authored Feb 2, 2023
1 parent a1b82c9 commit 0853a50
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
28 changes: 28 additions & 0 deletions syft/pkg/cataloger/binary/cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,34 @@ func TestClassifierCataloger_DefaultClassifiers_PositiveCases(t *testing.T) {
fixtureDir string
expected pkg.Package
}{
{
name: "positive-traefik-2.9.6",
fixtureDir: "test-fixtures/classifiers/positive/traefik-2.9.6",
expected: pkg.Package{
Name: "traefik",
Version: "2.9.6",
Type: "binary",
PURL: "pkg:generic/traefik@2.9.6",
Locations: singleLocation("traefik"),
Metadata: pkg.BinaryMetadata{
Classifier: "traefik-binary",
},
},
},
{
name: "positive-traefik-1.7.34",
fixtureDir: "test-fixtures/classifiers/positive/traefik-1.7.34",
expected: pkg.Package{
Name: "traefik",
Version: "1.7.34",
Type: "binary",
PURL: "pkg:generic/traefik@1.7.34",
Locations: singleLocation("traefik"),
Metadata: pkg.BinaryMetadata{
Classifier: "traefik-binary",
},
},
},
{
name: "positive-memcached-1.6.18",
fixtureDir: "test-fixtures/classifiers/positive/memcached-1.6.18",
Expand Down
10 changes: 10 additions & 0 deletions syft/pkg/cataloger/binary/default_classifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,14 @@ var defaultClassifiers = []classifier{
Package: "memcached",
PURL: mustPURL("pkg:generic/memcached@version"),
},
{
Class: "traefik-binary",
FileGlob: "**/traefik",
EvidenceMatcher: fileContentsVersionMatcher(
// [NUL]v1.7.34[NUL]
// [NUL]2.9.6[NUL]
`(?m)\x00v?(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha[0-9]|-beta[0-9]|-rc[0-9])?)\x00`),
Package: "traefik",
PURL: mustPURL("pkg:generic/traefik@version"),
},
}
Binary file not shown.
Binary file not shown.

0 comments on commit 0853a50

Please sign in to comment.