Skip to content

Commit

Permalink
Merge 5765ea0 into 8613c29
Browse files Browse the repository at this point in the history
  • Loading branch information
matthyx committed Sep 25, 2023
2 parents 8613c29 + 5765ea0 commit 4af2ae8
Show file tree
Hide file tree
Showing 4 changed files with 21 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
7 changes: 7 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,8 @@ func (a *BackendAdapter) SubmitCVE(ctx context.Context, cve domain.CVEManifest,
}
return err
}

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 4af2ae8

Please sign in to comment.