Skip to content

Some Java libraries are not being detected, or being mis-identified #3320

@dbrugman

Description

@dbrugman

What happened:
When scanning Docker images coming with many Java libraries (*.jar files), I noticed that some were either missing in the resulting SBOM, or were present but with the wrong name.

What you expected to happen:
I would expect all Java libraries to get detected and included in the SBOM with the correct names.

Steps to reproduce the issue:
Create a Docker image using this Dockerfile:

FROM ubuntu:latest

# These will NOT be detected by Syft 1.14.0:
ADD https://repo1.maven.org/maven2/net/datafaker/datafaker/1.9.0/datafaker-1.9.0.jar /java/
ADD https://repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar /java/

# This one will be detected but with the WRONG NAME:
ADD https://repo1.maven.org/maven2/com/datastax/oss/java-driver-core-shaded/4.17.0/java-driver-core-shaded-4.17.0.jar /java/

# This one WILL be detected correctly by Syft 1.14.0:
ADD https://repo1.maven.org/maven2/com/google/guava/guava/33.3.1-jre/guava-33.3.1-jre.jar /java/

Create an image:

docker build -t testjava .

Create an SBOM and search for the presence of Java libraries:

syft scan testjava | grep java-archive

Only 2 out of the 4 libraries are detected:

core                 4.17.0                       java-archive
guava                33.3.1-jre                   java-archive

And note that the name of the java-driver-core-shaded library is incorrectly shown as just core.

Anything else we need to know?:

Environment:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingecosystem:javarelating to the java ecosystem

    Type

    No type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions