Skip to content

Different naming of Golang standard library between trivy and cyclonedx-gomod #587

@beatrausch

Description

@beatrausch

Description

When running trivy and cyclonedx-gomod to generate SBOMs different names for the golang standard libraray component are assigned. This makes merging of SBOMs only possible with a hard coded list of alternative names.

Desired Behavior

Both trivy and cyclonedx-gomod assign the same name for the golang standard library stdlib to allow proper merging of SBOMs. Trivy uses the same identifier as the Go team does for vulnerabilities, e,g check.

Actual Behavior

The golang standard library is named as follows:

trivy: stdlib

{
      "bom-ref": "pkg:golang/stdlib@1.23.4",
      "type": "library",
      "name": "stdlib",
      "version": "1.23.4",
      "purl": "pkg:golang/stdlib@1.23.4",
      "properties": [
        {
          "name": "aquasecurity:trivy:LayerDiffID",
          "value": "sha256:f75706aada560f9fc3c035a44e9c8f8da8bf7317a39df18ae86c56fdd8344d66"
        },
        {
          "name": "aquasecurity:trivy:LayerDigest",
          "value": "sha256:9f888a47f0b0f4ecd36abfd90d4a77bc93fcedb6135f4d24fd36b6d6b232533c"
        },
        {
          "name": "aquasecurity:trivy:PkgType",
          "value": "gobinary"
        }
      ]
 },

cyclonedx-gomod: std

{
      "bom-ref": "pkg:golang/std@go1.23.4?type=module",
      "type": "library",
      "name": "std",
      "version": "go1.23.4",
      "scope": "required",
      "purl": "pkg:golang/std@go1.23.4?type=module\u0026goos=linux\u0026goarch=amd64"
},

Reproduction Steps

Create SBOM from trivy source code (v0.59.0)

  1. cyclonedx-gomod app -json -output cdx.sbom.json -std -main cmd/trivy
  2. trivy image --format cyclonedx --output trivy.sbom.json aquasec/trivy:0.59.0

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