Skip to content

Commit

Permalink
Strip leading slash before sbom ownership check
Browse files Browse the repository at this point in the history
I didn't catch this in testing because newer versions of melange don't
emit filenames with the leading slash, and I used a newer version of
melange to generate the testdata.

Everything seemed to work except for APKs that haven't been rebuilt
since melange was updated.

Signed-off-by: Jon Johnson <jon.johnson@chainguard.dev>
  • Loading branch information
jonjohnsonjr committed Dec 20, 2023
1 parent e5f7af4 commit 79511f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/sbom/generator/spdx/spdx.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ func copySBOMElements(sourceDoc, targetDoc *Document, todo map[string]struct{},

done[f.ID] = struct{}{}

f.Name = strings.TrimPrefix(f.Name, "/") // Strip leading slashes, which SPDX doesn't like.

if _, ok := ownedFiles[f.Name]; !ok {
continue
}

f.Name = strings.TrimPrefix(f.Name, "/") // Strip leading slashes, which SPDX doesn't like.

targetDoc.Files = append(targetDoc.Files, f)
}

Expand Down

0 comments on commit 79511f1

Please sign in to comment.