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

feat(sbom): add vulnerability support for SPDX formats #7213

Merged
merged 6 commits into from
Jul 25, 2024

Conversation

DmitriyLewen
Copy link
Contributor

@DmitriyLewen DmitriyLewen commented Jul 23, 2024

Description

SPDX v2.3 uses externalRefs for advisories (spdx-example).
See #6308 for more details

example:

➜ trivy -d image -f spdx-json -o report.spdx.json ubuntu --scanners vuln
...
  {
      "name": "libssl3t64",
      "SPDXID": "SPDXRef-Package-ed46e6c8dd5adb2d",
      "versionInfo": "3.0.13-0ubuntu3.1",
      "supplier": "Organization: Ubuntu Developers \[email protected]\u003e",
      "downloadLocation": "NONE",
      "filesAnalyzed": false,
      "sourceInfo": "built package from: openssl 3.0.13-0ubuntu3.1",
      "licenseConcluded": "Apache-2.0 AND Artistic AND GPL-1.0-only",
      "licenseDeclared": "Apache-2.0 AND Artistic AND GPL-1.0-only",
      "externalRefs": [
        {
          "referenceCategory": "PACKAGE-MANAGER",
          "referenceType": "purl",
          "referenceLocator": "pkg:deb/ubuntu/[email protected]?arch=amd64\u0026distro=ubuntu-24.04"
        },
        {
          "referenceCategory": "SECURITY",
          "referenceType": "advisory",
          "referenceLocator": "https://avd.aquasec.com/nvd/cve-2024-2511"
        },
        {
          "referenceCategory": "SECURITY",
          "referenceType": "advisory",
          "referenceLocator": "https://avd.aquasec.com/nvd/cve-2024-4603"
        },
        {
          "referenceCategory": "SECURITY",
          "referenceType": "advisory",
          "referenceLocator": "https://avd.aquasec.com/nvd/cve-2024-4741"
        }
      ],
      "attributionTexts": [
        "LayerDiffID: sha256:a30a5965a4f7d9d5ff76a46eb8939f58e95be844de1ac4a4b452d5d31158fdea",
        "LayerDigest: sha256:9c704ecd0c694c4cbdd85e589ac8d1fc3fd8f890b7f3731769a5b169eb495809",
        "PkgID: [email protected]",
        "PkgType: ubuntu"
      ],
      "primaryPackagePurpose": "LIBRARY"
    },
...

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@DmitriyLewen DmitriyLewen self-assigned this Jul 23, 2024
@DmitriyLewen DmitriyLewen marked this pull request as ready for review July 24, 2024 03:36
@DmitriyLewen DmitriyLewen requested a review from knqyf263 as a code owner July 24, 2024 03:36
@knqyf263
Copy link
Collaborator

@goneall Does it meet your requirements? Please feel free to point it out if we're missing something.

@goneall
Copy link

goneall commented Jul 24, 2024

https://avd.aquasec.com/nvd/cve-2024-2511

Yes - that meets the requirements. Thanks!

@@ -184,6 +193,9 @@ func (m *Marshaler) Marshal(ctx context.Context, bom *core.BOM) (*spdx.Document,
relationShips = append(relationShips, m.spdxRelationShip(refA, refB, m.spdxRelationshipType(rel.Type)))
}
}

bom.Vulnerabilities()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... Maybe I was checking something and forgot to delete it.
Thanks. Removed in b1ca52e

@knqyf263 knqyf263 added this pull request to the merge queue Jul 25, 2024
Merged via the queue into aquasecurity:main with commit efb1f69 Jul 25, 2024
12 checks passed
@DmitriyLewen DmitriyLewen deleted the feat-sbom/add-vuln-spdx branch July 25, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(sbom): add vulnerability support for SPDX format
3 participants