Skip to content

Commit

Permalink
update redis classifier (#3281)
Browse files Browse the repository at this point in the history
* update redis classifier
Signed-off-by: witchcraze <[email protected]>

* Remove snippets to pass Validation.
In this case, 9000 byte was required...
Signed-off-by: witchcraze <[email protected]>
  • Loading branch information
witchcraze authored Sep 30, 2024
1 parent 2a3d171 commit f5f8005
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
11 changes: 11 additions & 0 deletions syft/pkg/cataloger/binary/classifier_cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("redis-binary"),
},
},
{
logicalFixture: "redis-server/7.2.5/linux-386",
expected: pkg.Package{
Name: "redis",
Version: "7.2.5",
Type: "binary",
PURL: "pkg:generic/[email protected]",
Locations: locations("redis-server"),
Metadata: metadata("redis-binary"),
},
},
{
logicalFixture: "python-shared-lib/3.7.4/linux-amd64",
expected: pkg.Package{
Expand Down
2 changes: 1 addition & 1 deletion syft/pkg/cataloger/binary/classifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func DefaultClassifiers() []Classifier {
FileGlob: "**/redis-server",
EvidenceMatcher: evidenceMatchers(
FileContentsVersionMatcher(`(?s)payload %5.*?(?P<version>\d.\d\.\d\d*)[a-z0-9]{12,15}-[0-9]{19}`),
FileContentsVersionMatcher(`(?s)\x00(?P<version>\d.\d\.\d\d*)[a-z0-9]{12}-[0-9]{19}\x00.*?payload %5`),
FileContentsVersionMatcher(`(?s)\x00(?P<version>\d.\d\.\d\d*)[a-z0-9]{12,15}-[0-9]{19}\x00.*?payload %5`),
),
Package: "redis",
PURL: mustPURL("pkg:generic/redis@version"),
Expand Down
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 @@ -461,6 +461,13 @@ from-images:
paths:
- /usr/local/bin/redis-server

- version: 7.2.5
images:
- ref: redis:7.2.5@sha256:3b44455ef048b5f0a3a26d874c00c0f4ffe6a71a40834f2b038f816c6ad5ca4f
platform: linux/386
paths:
- /usr/local/bin/redis-server

- version: 2.9.0
images:
- ref: wordpress:cli-2.9.0-php8.3@sha256:3a008aafccc6a8d2d7ec2b069722cb43b3569b61cd833f9f2f13d74a9284746e
Expand Down

0 comments on commit f5f8005

Please sign in to comment.