Skip to content

POM runtime scope ignored #296

@ben12

Description

@ben12

If I understand, only compile scope dependencies are listed:

if (d.Scope != "" && d.Scope != "compile") || d.Optional {
continue
}
dependencies = append(dependencies, d.ToArtifact(opts))

So when I use Trivy, it seems what vulnerabilities in runtime scope dependencies are not found.
For example, if spring-cloud-starter-netflix-eureka-client is present in the pom.xml :

org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:4.0.3 [compile]
   -> com.netflix.eureka:eureka-client:2.0.1 [compile]
       -> org.codehaus.jettison:jettison:1.4.0 [runtime]

org.codehaus.jettison:jettison:1.4.0 is not analyzed, and these vulnerabilities are not found:

Using CycloneDX sbom:

├────────────────────────────────────────────┼────────────────┼──────────┤        ├───────────────────┼─────────────────────────────────────┼──────────────────────────────────────────────────────────────┤
│ org.codehaus.jettison:jettison             │ CVE-2022-40150 │ HIGH     │        │ 1.4.0             │ 1.5.2                               │ jettison: memory exhaustion via user-supplied XML or JSON    │
│                                            │                │          │        │                   │                                     │ data                                                         │
│                                            │                │          │        │                   │                                     │ https://avd.aquasec.com/nvd/cve-2022-40150                   │
│                                            ├────────────────┤          │        │                   │                                     ├──────────────────────────────────────────────────────────────┤
│                                            │ CVE-2022-45685 │          │        │                   │                                     │ jettison: stack overflow in JSONObject() allows attackers to │
│                                            │                │          │        │                   │                                     │ cause a Denial of...                                         │
│                                            │                │          │        │                   │                                     │ https://avd.aquasec.com/nvd/cve-2022-45685                   │
│                                            ├────────────────┤          │        │                   │                                     ├──────────────────────────────────────────────────────────────┤
│                                            │ CVE-2022-45693 │          │        │                   │                                     │ jettison: If the value in map is the map's self, the...      │
│                                            │                │          │        │                   │                                     │ https://avd.aquasec.com/nvd/cve-2022-45693                   │
│                                            ├────────────────┤          │        │                   ├─────────────────────────────────────┼──────────────────────────────────────────────────────────────┤
│                                            │ CVE-2023-1436  │          │        │                   │ 1.5.4                               │ jettison: Uncontrolled Recursion in JSONArray                │
│                                            │                │          │        │                   │                                     │ https://avd.aquasec.com/nvd/cve-2023-1436                    │
│                                            ├────────────────┼──────────┤        │                   ├─────────────────────────────────────┼──────────────────────────────────────────────────────────────┤
│                                            │ CVE-2022-40149 │ MEDIUM   │        │                   │ 1.5.1                               │ jettison: parser crash by stackoverflow                      │
│                                            │                │          │        │                   │                                     │ https://avd.aquasec.com/nvd/cve-2022-40149                   │
├────────────────────────────────────────────┼────────────────┤          │        ├───────────────────┼─────────────────────────────────────┼──────────────────────────────────────────────────────────────┤

I think runtime dependencies should be included.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions