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

Collect additional metadata for vulnerabilities from OSV #2219

Merged
merged 22 commits into from
Nov 25, 2024

Conversation

hown3d
Copy link
Contributor

@hown3d hown3d commented Oct 27, 2024

Description of the PR

This PR introduces a new flag, add-vuln-metadata, that enables the collection of severity information for CVEs directly from the OSV API. When this flag is enabled, the collected severity data is ingested into GUAC as a VulnerabilityMetadata nodes, enriching vulnerability data with additional context on severity levels.

Key Changes:

  • New Flag: Adds the add-vuln-metadata CLI flag.
  • Ingestion to GUAC: Captures the retrieved severity data and stores it as a VulnerabilityMetadata node, allowing for improved vulnerability assessment and analysis within GUAC.

This enhancement provides better visibility into CVE severity, enabling users to prioritize vulnerabilities more effectively based on standardized severity metrics.

PR Checklist

  • All commits have a Developer Certificate of Origin (DCO) -- they are generated using -s flag to git commit.
  • All new changes are covered by tests
  • If GraphQL schema is changed, make generate has been run
  • If GraphQL schema is changed, GraphQL client updates/additions have been made
  • If OpenAPI spec is changed, make generate has been run
  • If ent schema is changed, make generate has been run
  • If collectsub protobuf has been changed, make proto has been run
  • All CI checks are passing (tests and formatting)
  • All dependent PRs have already been merged

Signed-off-by: Lukas Hoehl [email protected]

@pxp928
Copy link
Collaborator

pxp928 commented Oct 28, 2024

Thanks @hown3d this is a great addition! Will review this soon!

@hown3d
Copy link
Contributor Author

hown3d commented Oct 28, 2024

For now I've only included the severity field from the OSV API.

I see potential in ingesting additional metadata like summary, details and references into GUAC.
Those are not part of the vulnerability attestation (yet?) though, so it's not clear how to parse these from the attestation into VulnerabilityMetadata nodes.

@pxp928
Copy link
Collaborator

pxp928 commented Oct 28, 2024

For now I've only included the severity field from the OSV API.

I see potential in ingesting additional metadata like summary, details and references into GUAC. Those are not part of the vulnerability attestation (yet?) though, so it's not clear how to parse these from the attestation into VulnerabilityMetadata nodes.

For the vulnerability summary, details..etc, our thought process was that information did not need to be stored in the graph. Rather, it can be retrieved client side when needed. The CVE - severity field are needed to make decisions.

So only information that is needed by admission control or some other policy engine should be in the graph and queryable. Other information can be obtained client side when needed from OSV.

@lumjjb lumjjb added the needs-review Needs writer LGTM label Oct 28, 2024
@pxp928 pxp928 requested review from pxp928 and lumjjb October 28, 2024 15:08
@pxp928
Copy link
Collaborator

pxp928 commented Nov 1, 2024

Sorry for the delay! I will review this soon!

Copy link
Collaborator

@pxp928 pxp928 left a comment

Choose a reason for hiding this comment

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

Overall this is a great PR, very comprehensive! We should just remove it from "on ingestion" otherwise this is good to go! Thank You!

cmd/guacingest/cmd/ingest.go Outdated Show resolved Hide resolved
cmd/guacone/cmd/deps_dev.go Outdated Show resolved Hide resolved
cmd/guacone/cmd/osv.go Outdated Show resolved Hide resolved
cmd/guacone/cmd/osv.go Show resolved Hide resolved
cmd/guaccollect/cmd/osv.go Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
pkg/cli/store.go Outdated Show resolved Hide resolved
pkg/ingestor/ingestor.go Outdated Show resolved Hide resolved
pkg/ingestor/parser/parser.go Outdated Show resolved Hide resolved
@hown3d
Copy link
Contributor Author

hown3d commented Nov 5, 2024

Overall this is a great PR, very comprehensive! We should just remove it from "on ingestion" otherwise this is good to go! Thank You!

Rechecking the code i don't think it's necessary to use a flag instead just defaulting to add vulnerability metadata. It introduces so many places to add this flag that it gets quite confusing.
I don't thinks it's a problem to always store the information for vulnerabilities in GUAC.

@pxp928
Copy link
Collaborator

pxp928 commented Nov 5, 2024

Rechecking the code i don't think it's necessary to use a flag instead just defaulting to add vulnerability metadata. It introduces so many places to add this flag that it gets quite confusing.
I don't thinks it's a problem to always store the information for vulnerabilities in GUAC.

For on ingestion we should default it to false (no need for a flag). The certifier can have a flag which the user can enable/disable if they want.

Copy link
Contributor

@lumjjb lumjjb left a comment

Choose a reason for hiding this comment

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

Awesome - this is a great addition to the OSV certifier, thanks @hown3d ! I have one request, else LGTM!

pkg/ingestor/parser/vuln/vuln.go Outdated Show resolved Hide resolved
dependabot bot and others added 10 commits November 21, 2024 17:21
* Bump github.com/99designs/gqlgen from 0.17.54 to 0.17.55

Bumps [github.com/99designs/gqlgen](https://github.com/99designs/gqlgen) from 0.17.54 to 0.17.55.
- [Release notes](https://github.com/99designs/gqlgen/releases)
- [Changelog](https://github.com/99designs/gqlgen/blob/master/CHANGELOG.md)
- [Commits](99designs/gqlgen@v0.17.54...v0.17.55)

---
updated-dependencies:
- dependency-name: github.com/99designs/gqlgen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* update generated code

Signed-off-by: pxp928 <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: pxp928 <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: pxp928 <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Signed-off-by: Lukas Hoehl <[email protected]>
Copy link
Collaborator

@pxp928 pxp928 left a comment

Choose a reason for hiding this comment

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

LGTM! I just have a concern on the timestamp that I may be misunderstanding?

pkg/ingestor/parser/vuln/vuln.go Outdated Show resolved Hide resolved
Copy link
Contributor

@lumjjb lumjjb left a comment

Choose a reason for hiding this comment

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

see follow up too comment. minor change

@kodiakhq kodiakhq bot merged commit 93427be into guacsec:main Nov 25, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-review Needs writer LGTM size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants