Skip to content

Direct dependencies missing if package is used as both direct and transitive dependency #1918

@rogu-beta

Description

@rogu-beta

Describe the bug
The dependency graph gathered from load_sbom does not accurately represent what is contained within the SBOM. If a package is both a direct dependency and transitive dependency at the same time, the listing will only show the package as a transitive dependency.

In the example given below, the package pkg:npm/%40angular/[email protected] is both a dependency to the global dejacode-demo representing the project and the package pkg:npm/@angular/[email protected]. This can be seen in the section:

"dependencies": [
        {
            "ref": "pkg:npm/dejacode-demo",
            "dependsOn": [
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@jsverse/[email protected]",
                "pkg:npm/@ngrx/[email protected]",
                "pkg:npm/@ngrx/[email protected]",
                "pkg:npm/[email protected]",
                "pkg:npm/[email protected]",
                "pkg:npm/[email protected]"
            ]
        },
{
            "ref": "pkg:npm/@angular/[email protected]",
            "dependsOn": [
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/@angular/[email protected]",
                "pkg:npm/[email protected]",
                "pkg:npm/[email protected]"
            ]
        },

However, the result in ScanCode.io only shows pkg:npm/@angular/[email protected] as a dependency of pkg:npm/@angular/[email protected].

System configuration

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project in ScanCode.io
  2. Upload the SBOM file
  3. Select load_sbom as pipeline
  4. Run the pipeline
  5. Once the job has completed open the dependencies
  6. Search for pkg:npm/@angular/[email protected] and notice that there is only one occurrence in the tree

Expected behavior
The tree should accurately represent all dependency relationships found in the SBOM

Screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions