anchore / anchore/syft

PHP extensions are cataloged as upstream products using the PHP version

Open
#5,014 4 comments 0 reactions 0 assignees View on GitHub
bug good-first-issue needs-investigation
Dominant language
Go
Stars
9.6k
Forks
954
Avg merge
23h 27m
Merged PRs (30d)
48

Description

**What happened**:

Syft detected PHP extension openssl.so as openssl 8.5.7.
This version is from the PHP. This is confusing because there is no OpenSSL release with version 8.5.7.

(all extensions may have simmilar issue)

**What you expected to happen**:

I'm not sure what the best representation should be.

However, the current artifact name and generated CPEs appear misleading. At minimum, it seems the PHP extension version should not be represented as an OpenSSL product version.

Both humans and downstream tooling may incorrectly interpret this as an OpenSSL installation.

**Steps to reproduce the issue**:

```
$ cat Dockerfile
FROM alpine:latest

RUN apk add --no-cache \
php \
php-openssl \
php-ldap \
php-sqlite3 \
&& rm -rf /lib/apk/db/*

$ docker build -t php-no-apkdb .

$ syft -q php-no-apkdb
NAME VERSION TYPE
busybox 1.37.0 binary
ldap 8.5.7 binary
openssl 8.5.7 binary
php-cli 8.5.7 binary
sqlite3 8.5.7 binary

$ syft -q php-no-apkdb -o json | jq '
.artifacts[]
| select(.name=="openssl" or .name=="ldap" or .name=="sqlite3")
'
{
"id": "6d44110f145d8345",
"name": "ldap",
"version": "8.5.7",
"type": "binary",
"foundBy": "php-interpreter-cataloger",
"locations": [
{
"path": "/usr/lib/php85/modules/ldap.so",
"layerID": "sha256:8f0d6cf4e04bbd60c8804ac0a4f7382928530643189440cb71720e9642032565",
"accessPath": "/usr/lib/php85/modules/ldap.so",
"annotations": {
"evidence": "primary"
}
}
],
"licenses": [],
"language": "",
"cpes": [
{
"cpe": "cpe:2.3:a:php-ldap:php-ldap:8.5.7:*:*:*:*:*:*:*",
"source": "syft-generated"
},
{
"cpe": "cpe:2.3:a:ldap:ldap:8.5.7:*:*:*:*:*:*:*",
"source": "syft-generated"
}
],
"purl": "pkg:generic/ldap@8.5.7",
"metadataType": "binary-signature",
"metadata": {
"matches": [
{
"classifier": "php-ext-ldap-binary",
"location": {
"path": "/usr/lib/php85/modules/ldap.so",
"layerID": "sha256:8f0d6cf4e04bbd60c8804ac0a4f7382928530643189440cb71720e9642032565",
"accessPath": "/usr/lib/php85/modules/ldap.so",
"annotations": {
"evidence": "primary"
}
}
}
]
}
}
{
"id": "393c571fbd5f55b2",
"name": "openssl",
"version": "8.5.7",
"type": "binary",
"foundBy": "php-interpreter-cataloger",
"locations": [
{
"path": "/usr/lib/php85/modules/openssl.so",
"layerID": "sha256:8f0d6cf4e04bbd60c8804ac0a4f7382928530643189440cb71720e9642032565",
"accessPath": "/usr/lib/php85/modules/openssl.so",
"annotations": {
"evidence": "primary"
}
}
],
"licenses": [],
"language": "",
"cpes": [
{
"cpe": "cpe:2.3:a:php-openssl:php-openssl:8.5.7:*:*:*:*:*:*:*",
"source": "syft-generated"
},
{
"cpe": "cpe:2.3:a:openssl:openssl:8.5.7:*:*:*:*:*:*:*",
"source": "syft-generated"
}
],
"purl": "pkg:generic/openssl@8.5.7",
"metadataType": "binary-signature",
"metadata": {
"matches": [
{
"classifier": "php-ext-openssl-binary",
"location": {
"path": "/usr/lib/php85/modules/openssl.so",
"layerID": "sha256:8f0d6cf4e04bbd60c8804ac0a4f7382928530643189440cb71720e9642032565",
"accessPath": "/usr/lib/php85/modules/openssl.so",
"annotations": {
"evidence": "primary"
}
}
}
]
}
}
{
"id": "5f4f1c80ed957a73",
"name": "sqlite3",
"version": "8.5.7",
"type": "binary",
"foundBy": "php-interpreter-cataloger",
"locations": [
{
"path": "/usr/lib/php85/modules/sqlite3.so",
"layerID": "sha256:8f0d6cf4e04bbd60c8804ac0a4f7382928530643189440cb71720e9642032565",
"accessPath": "/usr/lib/php85/modules/sqlite3.so",
"annotations": {
"evidence": "primary"
}
}
],
"licenses": [],
"language": "",
"cpes": [
{
"cpe": "cpe:2.3:a:php-sqlite3:php-sqlite3:8.5.7:*:*:*:*:*:*:*",
"source": "syft-generated"
},
{
"cpe": "cpe:2.3:a:sqlite3:sqlite3:8.5.7:*:*:*:*:*:*:*",
"source": "syft-generated"
},
{
"cpe": "cpe:2.3:a:sqlite3:sqlite:8.5.7:*:*:*:*:*:*:*",
"source": "syft-generated"
},
{
"cpe": "cpe:2.3:a:sqlite:sqlite3:8.5.7:*:*:*:*:*:*:*",
"source": "syft-generated"
},
{
"cpe": "cpe:2.3:a:sqlite:sqlite:8.5.7:*:*:*:*:*:*:*",
"source": "syft-generated"
}
],
"purl": "pkg:generic/sqlite3@8.5.7",
"metadataType": "binary-signature",
"metadata": {
"matches": [
{
"classifier": "php-ext-sqlite3-binary",
"location": {
"path": "/usr/lib/php85/modules/sqlite3.so",
"layerID": "sha256:8f0d6cf4e04bbd60c8804ac0a4f7382928530643189440cb71720e9642032565",
"accessPath": "/usr/lib/php85/modules/sqlite3.so",
"annotations": {
"evidence": "primary"
}
}
}
]
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the php-interpreter-cataloger entry point and reproduce the Docker example from the issue. Trace how PHP extension artifacts receive their names, versions, CPEs, and PURLs; done means extension metadata no longer presents the PHP interpreter version as the upstream extension product version.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go, php
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.