Skip to content

Commit

Permalink
fixes bad json parsing #547 (#548)
Browse files Browse the repository at this point in the history
* fixes bad json parsing #547

* lint fix
  • Loading branch information
ruigomescx authored Nov 30, 2020
1 parent 54f0b29 commit 0fd1875
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/kics/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package kics

import (
"context"
"encoding/json"
"io"
"io/ioutil"

Expand All @@ -11,6 +12,7 @@ import (
"github.com/Checkmarx/kics/pkg/source"
"github.com/google/uuid"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
)

type SourceProvider interface {
Expand Down Expand Up @@ -57,6 +59,12 @@ func (s *Service) StartScan(ctx context.Context, scanID string) error {
}

for _, document := range documents {
_, err = json.Marshal(document)
if err != nil {
log.Err(err).Msgf("failed to marshal document %s", document)
continue
}

file := model.FileMetadata{
ID: uuid.New().String(),
ScanID: scanID,
Expand Down

0 comments on commit 0fd1875

Please sign in to comment.