Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Fix secret detection in layer history
Browse files Browse the repository at this point in the history
  • Loading branch information
cdupuis committed Jan 5, 2023
1 parent 3eb6de3 commit 5d32054
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions sbom/trivy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package sbom

import (
"context"
"encoding/json"
"fmt"
"strings"

Expand Down Expand Up @@ -93,10 +92,9 @@ func trivySbom(cache *registry.ImageCache, lm *types.LayerMapping, resultChan ch
}
config := &cache.Source.Image.Metadata.Config
for o, h := range config.History {
js, _ := json.MarshalIndent(h, "", " ")
secrets := scanner.Scan(secret.ScanArgs{
FilePath: "history",
Content: js,
Content: []byte(fmt.Sprintf("%s\n%s\n%s", h.CreatedBy, h.Author, h.Comment)),
})
if len(secrets.Findings) > 0 {
result.Secrets = append(result.Secrets, convertSecretFindings(secrets, types.SecretSource{
Expand Down

0 comments on commit 5d32054

Please sign in to comment.