Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CycloneDX OS component does not have a bom-ref #2101

Closed
kzantow opened this issue Sep 6, 2023 · 2 comments · Fixed by #2634
Closed

CycloneDX OS component does not have a bom-ref #2101

kzantow opened this issue Sep 6, 2023 · 2 comments · Fixed by #2634
Assignees
Labels
bug Something isn't working

Comments

@kzantow
Copy link
Contributor

kzantow commented Sep 6, 2023

What happened:
Running syft ubuntu:latest -o cyclonedx-json includes a component representing the operating system, but it does not include a bom-ref:

    {
      "type": "operating-system",
      "name": "ubuntu",
      "version": "22.04",
      "description": "Ubuntu 22.04.3 LTS",
      "swid": {
        "tagId": "ubuntu", 
        "name": "ubuntu",
        "version": "22.04"
      },
      "externalReferences": [
        { 
          "url": "https://bugs.launchpad.net/ubuntu/",
          "type": "issue-tracker"
        },
        {
          "url": "https://www.ubuntu.com/",
          "type": "website"
        },
        {
          "url": "https://help.ubuntu.com/",
          "comment": "support",
          "type": "other"
        },
        {
          "url": "https://www.ubuntu.com/legal/terms-and-policies/privacy-policy",
          "comment": "privacyPolicy",
          "type": "other"
        }
      ],
      "properties": [
        {
          "name": "syft:distro:id",
          "value": "ubuntu"
        },
        {
          "name": "syft:distro:idLike:0",
          "value": "debian"
        },
        {
          "name": "syft:distro:prettyName",
          "value": "Ubuntu 22.04.3 LTS"
        },
        {
          "name": "syft:distro:versionCodename",
          "value": "jammy"
        },
        {
          "name": "syft:distro:versionID",
          "value": "22.04"
        }
      ]
    }

What you expected to happen:
A bom-ref is set for the component.

Steps to reproduce the issue:
syft ubuntu:latest -o cyclonedx-json

Anything else we need to know?:

Environment:

  • Output of syft version:
    Application: syft
    Version: 0.89.0
    BuildDate: 2023-08-31T14:50:32Z
    GitCommit: Homebrew
    GitDescription: [not provided]
    Platform: darwin/amd64
    GoVersion: go1.21.0
    Compiler: gc
@kzantow kzantow added the bug Something isn't working label Sep 6, 2023
@kzantow
Copy link
Contributor Author

kzantow commented Sep 6, 2023

This is probably the culprit:

return []cyclonedx.Component{
{
Type: cyclonedx.ComponentTypeOS,
// FIXME is it idiomatic to be using SWID here for specific name and version information?
SWID: &cyclonedx.SWID{
TagID: distro.ID,
Name: distro.ID,
Version: distro.VersionID,
},
Description: distro.PrettyName,
Name: distro.ID,
Version: distro.VersionID,
// TODO should we add a PURL?
CPE: formatCPE(distro.CPEName),
ExternalReferences: eRefs,
Properties: properties,
},
}

@wagoodman
Copy link
Contributor

One question I have about this is what should the bom-ref value be? Options:

  • generic package URL: pkg:generic/ubuntu@22.04
  • simple string: ubuntu@22.04

The only requirements given in the CycloneDX spec: "An optional identifier which can be used to reference the component elsewhere in the BOM. Every bom-ref should be unique."

The awkwardness with a PURL is that this component doesn't semantically represent a package, so a simple string is probably preferred here. Open to other suggestions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants