Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions syft/pkg/cataloger/binary/cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("gcc-binary"),
},
},
{
logicalFixture: "wp/2.9.0/linux-amd64",
expected: pkg.Package{
Name: "wp-cli",
Version: "2.9.0",
Type: "binary",
PURL: "pkg:generic/wp-cli@2.9.0",
Locations: locations("wp"),
Metadata: metadata("wordpress-cli-binary"),
},
},
}

for _, test := range tests {
Expand Down
11 changes: 11 additions & 0 deletions syft/pkg/cataloger/binary/default_classifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,17 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/gcc@version"),
CPEs: singleCPE("cpe:2.3:a:gnu:gcc:*:*:*:*:*:*:*:*"),
},
{
Class: "wordpress-cli-binary",
FileGlob: "**/wp",
EvidenceMatcher: FileContentsVersionMatcher(
// wp-cli/wp-cli 2.9.0'
`(?m)wp-cli/wp-cli (?P<version>[0-9]+\.[0-9]+\.[0-9]+)`,
),
Package: "wp-cli",
PURL: mustPURL("pkg:generic/wp-cli@version"),
CPEs: singleCPE("cpe:2.3:a:wp-cli:wp-cli:*:*:*:*:*:*:*:*"),
},
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: wp
offset: 6967657
length: 120
snippetSha256: fe7afa7db1b4efc55b3099b5b1fb46a34e34b147c708be0a74d1dd9fce2b5cac
fileSha256: af6b7ccc21ed0907cb504db5a059f0e120117905a6017bfdd4375cee3c93d864

### byte snippet to follow ###
ND CERTIFICATE-----
wp-cli/wp-cli 2.9.0 2023-10-25T09:10:40+00:00
composer/ca-bundle 1.3.7 76e46335014860eec1aa5a724799a
7 changes: 7 additions & 0 deletions syft/pkg/cataloger/binary/test-fixtures/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,13 @@ from-images:
paths:
- /usr/local/bin/redis-server

- version: 2.9.0
images:
- ref: wordpress:cli-2.9.0-php8.3@sha256:3a008aafccc6a8d2d7ec2b069722cb43b3569b61cd833f9f2f13d74a9284746e
platform: linux/amd64
paths:
- /usr/local/bin/wp

- version: 1.9.3p551
images:
- ref: ruby:1.9.3-p551@sha256:56b4a74e4fc2492b3b857bc94454dfa910f61e823a4bfab275d279bfa218eb05
Expand Down