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

Add DB providers command #2131

Closed
wagoodman opened this issue Sep 17, 2024 · 3 comments · Fixed by #2174
Closed

Add DB providers command #2131

wagoodman opened this issue Sep 17, 2024 · 3 comments · Fixed by #2174
Labels
enhancement New feature or request
Milestone

Comments

@wagoodman
Copy link
Contributor

It should be trivial to see what data providers (from vunnel) populated the DB, along with timestamp information:

grype db providers

alpine       2024-09-16T01:34:04.087474Z      ...
amazon       2024-09-16T01:34:04.087474Z      ...
chainguard   2024-10-16T01:34:04.087474Z      ...
debian       2024-09-16T01:34:04.087474Z      ...
github       2024-09-28T01:34:04.087474Z      ...
mariner      2024-09-16T01:34:04.087474Z
nvd          2023-11-16T01:34:04.087474Z
oracle       2024-09-16T01:34:04.087474Z
rhel         2024-09-16T01:34:04.087474Z
sles         2024-09-16T01:34:04.087474Z
ubuntu       2024-09-16T01:34:04.087474Z
wolfi        2024-09-16T01:34:04.087474Z

This should be available as:

  • table output
  • json output

Example JSON output:

{
  "providers": [
    {
      "name": "nvd",
      "dateCaptured": "2024-09-16T01:34:04.087474Z",
      ...
    },
    ...
  ]
}

Ideally we'd capture vunnel version information either in bulk or with each provider. For instance, see the prototype information capture here: https://github.com/anchore/grype/blob/db-v6-blob-store/grype/db/v6/models.go#L71-L95

@wagoodman wagoodman added the enhancement New feature or request label Sep 17, 2024
@wagoodman wagoodman added this to the DB v6 milestone Sep 17, 2024
@ADorigi
Copy link
Contributor

ADorigi commented Oct 3, 2024

Hi @wagoodman
I would be willing to work on this.

@willmurphyscode
Copy link
Contributor

Hi @ADorigi,

Thanks very much! Please let us know if you need any help getting started or have any questions.

Right now, the info you need is in provider-metadata.json in the Grype database cache location:

grype db status | grep -i location

will print the directory, in which is the provider-metadata.json:

{
  "providers": [
    {
      "name": "nvd",
      "lastSuccessfulRun": "2024-09-30T01:33:26.557315Z"
    },
    {
      "name": "alpine",
      "lastSuccessfulRun": "2024-09-30T01:32:56.048934Z"
    },
    {
      "name": "amazon",
      "lastSuccessfulRun": "2024-09-30T01:31:31.578651Z"
    },
    {
      "name": "chainguard",
      "lastSuccessfulRun": "2024-09-30T01:33:06.981914Z"
    },
    {
      "name": "debian",
      "lastSuccessfulRun": "2024-09-30T01:33:12.292992Z"
    },
    {
      "name": "github",
      "lastSuccessfulRun": "2024-09-30T01:33:05.711884Z"
    },
    {
      "name": "mariner",
      "lastSuccessfulRun": "2024-09-30T01:32:54.541848Z"
    },
    {
      "name": "oracle",
      "lastSuccessfulRun": "2024-09-30T01:32:47.580753Z"
    },
    {
      "name": "rhel",
      "lastSuccessfulRun": "2024-09-30T01:33:00.52897Z"
    },
    {
      "name": "sles",
      "lastSuccessfulRun": "2024-09-30T01:32:53.888701Z"
    },
    {
      "name": "ubuntu",
      "lastSuccessfulRun": "2024-09-30T01:33:21.911792Z"
    },
    {
      "name": "wolfi",
      "lastSuccessfulRun": "2024-09-30T01:32:58.824202Z"
    }
  ]
}
  • When grype db schema v6 lands, we'll switch out reading from this file to querying from the database, so the UI code shouldn't know too much about where the data came from
  • The provider-metadata.json file was added somewhat recently, so we should fail gracefully if the data aren't available

Don't hesitate to let us know if you need anything.

@ADorigi
Copy link
Contributor

ADorigi commented Oct 7, 2024

Thank you for the detailed explanation @willmurphyscode. I will be preparing a pull request soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants