Skip to content

fix: correct Apache Derby group ID in purl generation - #5090

Open
Ankush-Pathak wants to merge 1 commit into
anchore:mainfrom
Ankush-Pathak:fix-derby-groupid
Open

fix: correct Apache Derby group ID in purl generation#5090
Ankush-Pathak wants to merge 1 commit into
anchore:mainfrom
Ankush-Pathak:fix-derby-groupid

Conversation

@Ankush-Pathak

@Ankush-Pathak Ankush-Pathak commented Jul 22, 2026

Copy link
Copy Markdown

Description

Apache Derby jars (derby, derbyshared, derbytools, …) are OSGi bundles that ship no pom.properties/pom.xml. With no pom metadata, syft falls through to the manifest heuristic (groupIDFromJavaManifest), which walks PrimaryJavaManifestGroupIDFields and returns the first value starting with a TLD prefix. For Derby that is Bundle-Activator: org.apache.derby.osgi.EmbeddedActivator (Bundle-SymbolicName: derby is skipped because it has no TLD prefix).

The result is a wrong purl:

  • before: pkg:maven/org.apache.derby.osgi.EmbeddedActivator/derby@10.16.1.1
  • after: pkg:maven/org.apache.derby/derby@10.16.1.1

Because the group ID is wrong, downstream matchers (e.g. grype's Maven/GHSA matcher, which does not use CPEs for Java by default) fail to match advisories like GHSA-rcjc-c4pj-xxrp / CVE-2022-46337 (Critical), even though the jar is clearly the affected org.apache.derby:derby.

This adds the Derby artifacts to DefaultArtifactIDToGroupID so the known-package-list step (which runs before the manifest heuristic) supplies the correct group ID. All six are published under org.apache.derby on Maven Central.

Validation

Built syft with this change and cataloged real Derby jars from Maven Central:

jar purl (after fix) grype (default config)
derby-10.16.1.1.jar (vulnerable) pkg:maven/org.apache.derby/derby@10.16.1.1 detects GHSA-rcjc-c4pj-xxrp (Critical) — previously missed
derby-10.17.1.0.jar (fixed, latest) pkg:maven/org.apache.derby/derby@10.17.1.0 no findings — no false positive on the patched version

Before the fix the purl was pkg:maven/org.apache.derby.osgi.EmbeddedActivator/derby@…; the stray apache:EmbeddedActivator / apache:osgi CPE candidates are also gone. For jars that do embed pom metadata the pom-based steps still take precedence, so the map entry only applies when the coordinates are otherwise unavailable.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Apache Derby artifacts use the group ID org.apache.derby, but their jars
are OSGi bundles that ship no pom metadata. syft's manifest heuristic then
picks up Bundle-Activator (org.apache.derby.osgi.EmbeddedActivator) as the
group ID, producing an incorrect purl like
pkg:maven/org.apache.derby.osgi.EmbeddedActivator/derby@10.16.1.1 instead of
pkg:maven/org.apache.derby/derby@10.16.1.1. The bad group ID prevents grype
from matching Maven/GHSA advisories such as GHSA-rcjc-c4pj-xxrp
(CVE-2022-46337).

Add the Derby artifacts to the DefaultArtifactIDToGroupID map so the known
package list takes precedence over the manifest heuristic:
- derby
- derbyclient
- derbynet
- derbyoptionaltools
- derbyshared
- derbytools

Signed-off-by: Ankush Pathak <ankush.pathak@chainguard.dev>
@Ankush-Pathak
Ankush-Pathak marked this pull request as ready for review July 23, 2026 17:03
@Ankush-Pathak

Copy link
Copy Markdown
Author

@wagoodman could you approve the workflows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant