Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 5d32054

Browse files
committed
Fix secret detection in layer history
1 parent 3eb6de3 commit 5d32054

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

sbom/trivy.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package sbom
1818

1919
import (
2020
"context"
21-
"encoding/json"
2221
"fmt"
2322
"strings"
2423

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

0 commit comments

Comments
 (0)