Skip to content

Commit 4becce0

Browse files
committed
fix: fix grype pkg:golang/k8s.io/[email protected] does not show cve because namespace not handled
1 parent f100d57 commit 4becce0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: grype/pkg/purl_provider.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,16 @@ func purlToPackage(rawLine string) (*Package, *pkg.Package, string, string, erro
201201
PURL: purl.String(),
202202
Language: pkg.LanguageByName(purl.Type),
203203
}
204+
name := purl.Name
205+
if purl.Namespace != "" {
206+
name = fmt.Sprintf("%s/%s", purl.Namespace, purl.Name)
207+
}
204208

205209
syftPkg.SetID()
206210
return &Package{
207211
ID: ID(purl.String()),
208212
CPEs: cpes,
209-
Name: purl.Name,
213+
Name: name,
210214
Version: version,
211215
Type: pkgType,
212216
Language: pkg.LanguageByName(purl.Type),

0 commit comments

Comments
 (0)