kubescape / kubevuln

Kubevuln is an in-cluster component of the Kubescape security platform. It scans container images for vulnerabilities, using Grype as its engine.
Apache License 2.0
17 stars 19 forks source link

Feat store syft sboms #190

Closed vladklokun closed 6 months ago

vladklokun commented 6 months ago

Type

Enhancement


Description

This Pull Request introduces significant changes to the generation and storage of Software Bill of Materials (SBOMs) using Syft. The main updates include:


PR changes walkthrough

Relevant files                                                                                                                                 
Enhancement
3 files
syft.go                                                                                                         
    adapters/v1/syft.go

    The `CreateSBOM` function has been significantly refactored
    to improve the generation of SBOMs. The function now uses
    the `detectSource` and `generateSBOM` helper functions to
    simplify the process of generating SBOMs. The `detectSource`
    function uses the Syft library's `Detect` function to
    determine the source of the image, and the `generateSBOM`
    function uses the `RunTask` function from the Syft library's
    `eventloop` package to generate the SBOM.
+102/-201
syft_utils.go                                                                                             
    adapters/v1/syft_utils.go

    This new file introduces utility functions for handling hash
    algorithms. The `Hashers` function returns a list of hash
    algorithms based on the provided names, and the
    `CleanDigestAlgorithmName` function cleans the name of a
    digest algorithm.
+40/-0
sbom.go                                                                                                         
    core/domain/sbom.go

    The `SBOM` struct has been modified to use `SyftDocument`
    instead of `Document` for its `Content` field. This change
    reflects the use of the Syft library for generating SBOMs.
+1/-1
Dependencies
3 files
domain_to_syft.go                                                                                     
    adapters/v1/domain_to_syft.go

    The import paths have been updated to reflect changes in the
    Syft library. The `spdxhelpers` package is now imported from
    `github.com/anchore/syft/syft/format/common/spdxhelpers`
    instead of
    `github.com/anchore/syft/syft/formats/common/spdxhelpers`.
+1/-1
go.mod                                                                                                           
    go.mod

    The dependencies have been updated, likely to reflect
    changes in the Syft library.
+136/-88
go.sum                                                                                                           
    go.sum

    The dependencies have been updated, likely to reflect
    changes in the Syft library.
+370/-205

User description

Overview

codiumai-pr-agent[bot] commented 6 months ago

PR Description updated to latest commit (https://github.com/kubescape/kubevuln/commit/e728100d125f77bea4bf426ceff198943516a13f)

codiumai-pr-agent[bot] commented 6 months ago

PR Analysis

How to use

Instructions > To invoke the PR-Agent, add a comment using one of the following commands: > **/review**: Request a review of your Pull Request. > **/describe**: Update the PR title and description based on the contents of the PR. > **/improve [--extended]**: Suggest code improvements. Extended mode provides a higher quality feedback. > **/ask \**: Ask a question about the PR. > **/update_changelog**: Update the changelog based on the PR's contents. > **/add_docs**: Generate docstring for new components introduced in the PR. > **/generate_labels**: Generate labels for the PR based on the PR's contents. > see the [tools guide](https://github.com/Codium-ai/pr-agent/blob/main/docs/TOOLS_GUIDE.md) for more details. >To edit any configuration parameter from the [configuration.toml](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml), add --config_path=new_value. >For example: /review --pr_reviewer.extra_instructions="focus on the file: ..." >To list the possible configuration parameters, add a **/config** comment.