mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
feat: Add php binary catalogers (#1444)
* add php classifier Signed-off-by: witchcraze <witchcraze@gmail.com> * make lint-fix Signed-off-by: witchcraze <witchcraze@gmail.com>
This commit is contained in:
parent
a8416d674b
commit
d524bd5fc3
@ -17,6 +17,48 @@ func TestClassifierCataloger_DefaultClassifiers_PositiveCases(t *testing.T) {
|
|||||||
fixtureDir string
|
fixtureDir string
|
||||||
expected pkg.Package
|
expected pkg.Package
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
name: "positive-php-cli-8.2.1",
|
||||||
|
fixtureDir: "test-fixtures/classifiers/positive/php-cli-8.2.1",
|
||||||
|
expected: pkg.Package{
|
||||||
|
Name: "php-cli",
|
||||||
|
Version: "8.2.1",
|
||||||
|
Type: "binary",
|
||||||
|
PURL: "pkg:generic/php-cli@8.2.1",
|
||||||
|
Locations: singleLocation("php"),
|
||||||
|
Metadata: pkg.BinaryMetadata{
|
||||||
|
Classifier: "php-cli-binary",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "positive-php-fpm-8.2.1",
|
||||||
|
fixtureDir: "test-fixtures/classifiers/positive/php-fpm-8.2.1",
|
||||||
|
expected: pkg.Package{
|
||||||
|
Name: "php-fpm",
|
||||||
|
Version: "8.2.1",
|
||||||
|
Type: "binary",
|
||||||
|
PURL: "pkg:generic/php-fpm@8.2.1",
|
||||||
|
Locations: singleLocation("php-fpm"),
|
||||||
|
Metadata: pkg.BinaryMetadata{
|
||||||
|
Classifier: "php-fpm-binary",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "positive-php-apache-8.2.1",
|
||||||
|
fixtureDir: "test-fixtures/classifiers/positive/php-apache-8.2.1",
|
||||||
|
expected: pkg.Package{
|
||||||
|
Name: "libphp",
|
||||||
|
Version: "8.2.1",
|
||||||
|
Type: "binary",
|
||||||
|
PURL: "pkg:generic/php@8.2.1",
|
||||||
|
Locations: singleLocation("libphp.so"),
|
||||||
|
Metadata: pkg.BinaryMetadata{
|
||||||
|
Classifier: "php-apache-binary",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "positive-redis-2.8.23",
|
name: "positive-redis-2.8.23",
|
||||||
fixtureDir: "test-fixtures/classifiers/positive/redis-server-2.8.23",
|
fixtureDir: "test-fixtures/classifiers/positive/redis-server-2.8.23",
|
||||||
|
|||||||
@ -104,4 +104,32 @@ var defaultClassifiers = []classifier{
|
|||||||
`(?m)BusyBox\s+v(?P<version>[0-9]+\.[0-9]+\.[0-9]+)`),
|
`(?m)BusyBox\s+v(?P<version>[0-9]+\.[0-9]+\.[0-9]+)`),
|
||||||
Package: "busybox",
|
Package: "busybox",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Class: "php-cli-binary",
|
||||||
|
FileGlob: "**/php*",
|
||||||
|
EvidenceMatcher: fileNameTemplateVersionMatcher(
|
||||||
|
`(.*/|^)php[0-9]*$`,
|
||||||
|
`(?m)X-Powered-By: PHP\/(?P<version>[0-9]+\.[0-9]+\.[0-9]+(beta[0-9]+|alpha[0-9]+|RC[0-9]+)?)`),
|
||||||
|
Package: "php-cli",
|
||||||
|
PURL: mustPURL("pkg:generic/php-cli@version"),
|
||||||
|
CPEs: singleCPE("cpe:2.3:a:php:php:*:*:*:*:*:*:*:*"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Class: "php-fpm-binary",
|
||||||
|
FileGlob: "**/php-fpm*",
|
||||||
|
EvidenceMatcher: fileContentsVersionMatcher(
|
||||||
|
`(?m)X-Powered-By: PHP\/(?P<version>[0-9]+\.[0-9]+\.[0-9]+(beta[0-9]+|alpha[0-9]+|RC[0-9]+)?)`),
|
||||||
|
Package: "php-fpm",
|
||||||
|
PURL: mustPURL("pkg:generic/php-fpm@version"),
|
||||||
|
CPEs: singleCPE("cpe:2.3:a:php:php:*:*:*:*:*:*:*:*"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Class: "php-apache-binary",
|
||||||
|
FileGlob: "**/libphp*.so",
|
||||||
|
EvidenceMatcher: fileContentsVersionMatcher(
|
||||||
|
`(?m)X-Powered-By: PHP\/(?P<version>[0-9]+\.[0-9]+\.[0-9]+(beta[0-9]+|alpha[0-9]+|RC[0-9]+)?)`),
|
||||||
|
Package: "libphp",
|
||||||
|
PURL: mustPURL("pkg:generic/php@version"),
|
||||||
|
CPEs: singleCPE("cpe:2.3:a:php:php:*:*:*:*:*:*:*:*"),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +1,2 @@
|
|||||||
!libpython3.7.so
|
!libpython3.7.so
|
||||||
|
!libphp.so
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
[null] Script: '%s'
|
||||||
|
%s,%s
|
||||||
|
X-Powered-By: PHP/8.2.1
|
||||||
|
index pointer
|
||||||
|
PHP_VERSION
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
[null] Script: '%s'
|
||||||
|
%s,%s
|
||||||
|
X-Powered-By: PHP/8.2.1
|
||||||
|
index pointer
|
||||||
|
PHP_VERSION
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
[null] Script: '%s'
|
||||||
|
%s,%s
|
||||||
|
X-Powered-By: PHP/8.2.1
|
||||||
|
index pointer
|
||||||
|
PHP_VERSION
|
||||||
Loading…
x
Reference in New Issue
Block a user