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

fix(spdx): add workaround for no src packages #4118

Merged
merged 1 commit into from
Apr 28, 2023

Conversation

masahiro331
Copy link
Contributor

@masahiro331 masahiro331 commented Apr 25, 2023

Description

The existing implementation already supported SPDX.
Fixed a bug in SourceInfo information in some packages as an implementation of SPDX.

And, support cyclonedx sbom for vm scan.

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).

@masahiro331 masahiro331 self-assigned this Apr 25, 2023
@@ -282,7 +282,7 @@ func (m *Marshaler) pkgToSpdxPackage(t, pkgDownloadLocation string, class types.
}

var pkgSrcInfo string
if class == types.ClassOSPkg {
if class == types.ClassOSPkg && pkg.SrcName != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would you elaborate on that?

Copy link
Contributor Author

@masahiro331 masahiro331 Apr 25, 2023

Choose a reason for hiding this comment

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

Some packages don't have srcName.
e.g.

        {
          "ID": "gpg-pubkey@c87f5b1a-593863f8.",
          "Name": "gpg-pubkey",
          "Version": "c87f5b1a",
          "Release": "593863f8",
          "Arch": "None",
          "Licenses": [
            "pubkey"
          ],
          "Layer": {}
        },

In this case, spdx output empty SourceInfo.

##### Package: gpg-pubkey

PackageName: gpg-pubkey
SPDXID: SPDXRef-Package-6c5513710c857f3f
PackageVersion: c87f5b1a-593863f8
PackageDownloadLocation: NONE
FilesAnalyzed: false
PackageSourceInfo: built package from: 
PackageLicenseConcluded: pubkey
PackageLicenseDeclared: pubkey
ExternalRef: PACKAGE-MANAGER purl pkg:rpm/amazon/gpg-pubkey@c87f5b1a-593863f8?arch=None&distro=amazon-2%20%28Karoo%29
PackageAttributionText: PkgID: gpg-pubkey@c87f5b1a-593863f8.

@masahiro331 masahiro331 marked this pull request as ready for review April 26, 2023 17:47
@knqyf263 knqyf263 merged commit 1be1e2e into aquasecurity:main Apr 28, 2023
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.

SPDX support for VM images
2 participants