Skip to content

Commit

Permalink
Merge branch 'main' of github.com:kubescape/kubevuln into store-summa…
Browse files Browse the repository at this point in the history
…ry-CR-objects-adjustments
  • Loading branch information
Raziel Cohen committed Sep 30, 2023
2 parents 1d340c7 + fb2509b commit 26a5470
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
11 changes: 10 additions & 1 deletion adapters/mockcve.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ func (m MockCVEAdapter) ScanSBOM(ctx context.Context, sbom domain.SBOM) (domain.
CVEDBVersion: m.DBVersion(ctx),
Annotations: sbom.Annotations,
Labels: sbom.Labels,
Content: &v1beta1.GrypeDocument{},
Content: &v1beta1.GrypeDocument{
Matches: []v1beta1.Match{
{
Vulnerability: v1beta1.Vulnerability{},
RelatedVulnerabilities: nil,
MatchDetails: nil,
Artifact: v1beta1.GrypePackage{},
},
},
},
}, nil
}

Expand Down
8 changes: 8 additions & 0 deletions adapters/v1/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/hashicorp/go-multierror"
backendClientV1 "github.com/kubescape/backend/pkg/client/v1"
sysreport "github.com/kubescape/backend/pkg/server/v1/systemreports"
"github.com/kubescape/go-logger"
"github.com/kubescape/go-logger/helpers"
"github.com/kubescape/kubevuln/core/domain"
"github.com/kubescape/kubevuln/core/ports"
"go.opentelemetry.io/otel"
Expand Down Expand Up @@ -249,3 +251,9 @@ func (a *BackendAdapter) SubmitCVE(ctx context.Context, cve domain.CVEManifest,
}
return err
}

//lint:ignore U1000 Ignore unused function temporarily for debugging
func httpPostDebug(httpClient httputils.IHttpClient, fullURL string, headers map[string]string, body []byte) (*http.Response, error) {
logger.L().Debug("httpPostDebug", helpers.String("fullURL", fullURL), helpers.Interface("headers", headers), helpers.String("body", string(body)))
return httputils.HttpPostWithContext(context.Background(), httpClient, fullURL, headers, body)
}
3 changes: 2 additions & 1 deletion adapters/v1/grype.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ func (g *GrypeAdapter) ScanSBOM(ctx context.Context, sbom domain.SBOM) (domain.C
}

logger.L().Debug("returning CVE manifest",
helpers.String("name", sbom.Name))
helpers.String("name", sbom.Name),
helpers.Int("vulnerabilities", len(vulnerabilityResults.Matches)))
return domain.CVEManifest{
Name: sbom.Name,
SBOMCreatorVersion: sbom.SBOMCreatorVersion,
Expand Down
3 changes: 2 additions & 1 deletion adapters/v1/syft.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ func (s *SyftAdapter) CreateSBOM(ctx context.Context, name, imageID string, opti
domainSBOM.Content, err = s.syftToDomain(syftSBOM)
// return SBOM
logger.L().Debug("returning SBOM",
helpers.String("imageID", imageID))
helpers.String("imageID", imageID),
helpers.Int("packages", len(domainSBOM.Content.Packages)))
return domainSBOM, err
}

Expand Down

0 comments on commit 26a5470

Please sign in to comment.