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

BREAKING: add new classes for vulnerabilities #2541

Merged
merged 11 commits into from
Jul 31, 2022
Merged

BREAKING: add new classes for vulnerabilities #2541

merged 11 commits into from
Jul 31, 2022

Conversation

knqyf263
Copy link
Collaborator

@knqyf263 knqyf263 commented Jul 18, 2022

Description

This PR introduces new classes, vuln-os-pkgs and vuln-lang-pkgs. Packages and Vulnerabilities are stored separately.

Before

There is a single target including both packages and vulnerabilities.

{
	"Target": "rails:latest (centos 8.3.2011)",
	"Class":  "os-pkgs",
	"Type":   "centos",
	"Packages": {
		{
			"Name":            "binutils",
			"Version":         "2.30",
			"Release":         "93.el8",
			"Epoch":           0,
			"Arch":            "aarch64",
			"Licenses":       ["GPLv3+"],
		}
	},
	"Vulnerabilities": {
		{
			"VulnerabilityID":  "CVE-2018-20623",
			"PkgName":          "binutils",
			"InstalledVersion": "2.30-93.el8",
			...
		}
	}
}

After

There are two targets for packages and vulnerabilities.

{
	"Target": "rails:latest (centos 8.3.2011)",
	"Class":  "os-pkgs",
	"Type":   "centos",
	"Packages": {
		{
			"Name":            "binutils",
			"Version":         "2.30",
			"Release":         "93.el8",
			"Epoch":           0,
			"Arch":            "aarch64",
			"Licenses":       ["GPLv3+"],
		}
	}
},
{
	"Target": "rails:latest (centos 8.3.2011)",
	"Class":  "vuln-os-pkgs",
	"Type":   "centos",
	"Vulnerabilities": {
		{
			"VulnerabilityID":  "CVE-2018-20623",
			"PkgName":          "binutils",
			"InstalledVersion": "2.30-93.el8",
			...
		}
	}
}

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

@knqyf263 knqyf263 self-assigned this Jul 18, 2022
@knqyf263 knqyf263 requested review from masahiro331 and afdesk July 19, 2022 09:05
@knqyf263 knqyf263 marked this pull request as ready for review July 19, 2022 09:05
docs/docs/sbom/index.md Outdated Show resolved Hide resolved
pkg/flag/options.go Outdated Show resolved Hide resolved
Comment on lines +56 to 63
pkgs := map[string][]ftypes.Package{}
for _, result := range report.Results {
if result.Class == types.ClassOSPkg || result.Class == types.ClassLangPkg {
pkgs[result.Target] = result.Packages
}
}

for _, result := range report.Results {
Copy link
Contributor

Choose a reason for hiding this comment

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

these cycles look like the same, isn't it?

Copy link
Collaborator Author

@knqyf263 knqyf263 Jul 19, 2022

Choose a reason for hiding this comment

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

No, we have to take packages from report.Results before writing the table output

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added a comment
1ed1d28

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.

2 participants