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

[EPIC] Experiment with Syft Support #33

Open
4 of 7 tasks
doughertym opened this issue Sep 26, 2023 · 2 comments
Open
4 of 7 tasks

[EPIC] Experiment with Syft Support #33

doughertym opened this issue Sep 26, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@doughertym
Copy link

doughertym commented Sep 26, 2023

https://github.com/anchore/syft provides support for creating SBOM files for a wide variety of languages and frameworks, which might be worth exploring if and how it could help the https://github.com/corgibytes/freshli-cli process more repositories.

Tasks

Preview Give feedback
@doughertym doughertym self-assigned this Sep 26, 2023
@doughertym doughertym modified the milestones: v0.6.0, v0.7.0 Sep 26, 2023
@doughertym
Copy link
Author

doughertym referenced this issue in corgibytes/freshli-agent-syft Oct 3, 2023
doughertym referenced this issue in corgibytes/freshli-agent-syft Oct 4, 2023
@doughertym
Copy link
Author

Notes from my 05/Oct/2023 journal entry:

I was able to get the skeleton of the agent up and running. But there are a few things that need to be discussed and some things that need to be finished. I got to the point where the gRPC server can be started and stopped. The two main endpoints for DetectManifests and ProcessManifest exist, but do not do anything yet. The simplest way would seem to be invoking the cli Command on the path. But that did not seem to work as expected. Maybe I was missing something though. Might need a fresh brain before going after that again. In any event, it should work out somehow. Though, unfortunately the implementors of Syft did not abstract the actual processing of the data from the Command Interface (cli interface). If they had, then it would make things easier.

The other thing is that Syft does both tasks, DetectManifests and ProcessManifest, in one as the result of running syft is to have a bom with all the information. For example:

{
  "components": [
    {
      "bom-ref": "pkg:nuget/[email protected]?package-id=50796c5039f30ee9",
      "type": "library",
      "name": "AutoMapper",
      "version": "6.1.1",
      "cpe": "cpe:2.3:a:AutoMapper:AutoMapper:6.1.1:*:*:*:*:*:*:*",
      "purl": "pkg:nuget/[email protected]",
      "properties": [
        {
          "name": "syft:package:foundBy",
          "value": "dotnet-deps-cataloger"
        },
        {
          "name": "syft:package:language",
          "value": "dotnet"
        },
        {
          "name": "syft:package:metadataType",
          "value": "DotnetDepsMetadata"
        },
        {
          "name": "syft:package:type",
          "value": "dotnet"
        },
        {
          "name": "syft:location:0:path",
          "value": "/src/nhsweb/nhs.deps.json"
        }
      ]
    }
  ]
}

The properties.[@name = 'syft:location:0:path'].value (appended to ${folderName}) will be the Manifest location. I have not, as of yet, seen a way to just get the manifest files. Though, with some simple logic, it can be determined, so it's not impossible.

Lastly, what happens after the manifests have been processed into BOMs? If I understand the freshli-cli it will use the same agent to get the RetrieveReleaseHistory as it did to find and process the manifest. Though, I think it could be updated to do it a little differently. The code could use that value of properties.[@name = 'syft:package:language'].value to determine which language agent to use for getting the package history. This seems like the most logical approach, though the downside is that the freshli-cli would need to know how to interpret the Syft agent's BOM file specifically, which is diverging away from the intent that it be agnostic about this stuff. All that said, I am sure there is a way to abstract out the Syft specific logic enough to minimize the impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

No branches or pull requests

1 participant