Skip to content

Commit 74e8a39

Browse files
authored
explicitly set the target type for trivy (#880)
1 parent d18bcf1 commit 74e8a39

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

components/scanners/trivy/internal/transformer/transformer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ func (g *trivyTransformer) AddMetadataToDatasources(ctx context.Context, finding
167167
if err := protojson.Unmarshal([]byte(source), &dataSource); err != nil {
168168
return nil, errors.Errorf("could not unmarshal datasource %s, err:%w", source, err)
169169
}
170+
dataSource.TargetType = ocsffindinginfo.DataSource_TARGET_TYPE_CONTAINER_IMAGE
170171
dataSource.SourceCodeMetadata = targetMetadata.SourceCodeMetadata
171172
dataSource.OciPackageMetadata = targetMetadata.OciPackageMetadata
172173
metadataSource, err := protojson.Marshal(&dataSource)

components/scanners/trivy/internal/transformer/transformer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func TestTrivyTransformer_Transform(t *testing.T) {
175175
)
176176
assert.Equalf(
177177
t,
178-
ocsffindinginfo.DataSource_TARGET_TYPE_UNSPECIFIED,
178+
ocsffindinginfo.DataSource_TARGET_TYPE_CONTAINER_IMAGE,
179179
dataSource.TargetType,
180180
"Unexpected data source target type for finding %d",
181181
idx,

0 commit comments

Comments
 (0)