fix: correct Spring LDAP group ID in purl generation (#4908)

* fix: correct Spring LDAP group ID in purl generation

The Spring LDAP artifacts use the group ID org.springframework.ldap
(not org.springframework). This caused syft to generate incorrect purls
like pkg:maven/spring-ldap-core/spring-ldap-core@3.1.4 instead of the
correct pkg:maven/org.springframework.ldap/spring-ldap-core@3.1.4.

Add all Spring LDAP artifacts to the DefaultArtifactIDToGroupID map:
- spring-ldap
- spring-ldap-core
- spring-ldap-core-tiger
- spring-ldap-ldif-core
- spring-ldap-odm
- spring-ldap-test

Closes #4030

Signed-off-by: Jonas Boos <jonasboos@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix formatting

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* add test

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Jonas Boos <jonasboos@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Jonas Boos <jonasboos@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Jonas Boos 2026-07-13 21:31:35 +02:00 committed by GitHub
parent e854078fb0
commit fabd760914
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 1 deletions

View File

@ -381,7 +381,14 @@ var DefaultArtifactIDToGroupID = map[string]string{
"spring-jms": "org.springframework", "spring-jms": "org.springframework",
"spring-jmx": "org.springframework", "spring-jmx": "org.springframework",
"spring-jpa": "org.springframework", "spring-jpa": "org.springframework",
"spring-ldap": "org.springframework", "spring-ldap": "org.springframework.ldap",
"spring-ldap-core": "org.springframework.ldap",
"spring-ldap-core-tiger": "org.springframework.ldap",
"spring-ldap-ldif-batch": "org.springframework.ldap",
"spring-ldap-ldif-core": "org.springframework.ldap",
"spring-ldap-odm": "org.springframework.ldap",
"spring-ldap-test": "org.springframework.ldap",
"spring-ldap-tiger": "org.springframework.ldap",
"spring-messaging": "org.springframework", "spring-messaging": "org.springframework",
"spring-mock": "org.springframework", "spring-mock": "org.springframework",
"spring-ojb": "org.springframework", "spring-ojb": "org.springframework",

View File

@ -171,6 +171,20 @@ func Test_groupIDFromJavaMetadata(t *testing.T) {
metadata: pkg.JavaArchive{}, metadata: pkg.JavaArchive{},
expect: "org.apache.ant", expect: "org.apache.ant",
}, },
{
// regression for github.com/anchore/syft/issues/4030: spring-ldap artifacts
// live under org.springframework.ldap, not org.springframework
name: "known package list spring-ldap-core",
pkgName: "spring-ldap-core",
metadata: pkg.JavaArchive{},
expect: "org.springframework.ldap",
},
{
name: "known package list spring-ldap",
pkgName: "spring-ldap",
metadata: pkg.JavaArchive{},
expect: "org.springframework.ldap",
},
{ {
name: "java manifest", name: "java manifest",
metadata: pkg.JavaArchive{ metadata: pkg.JavaArchive{