Skip to content

Commit dd8a062

Browse files
committed
Correction of the purl generation for apk package
The purl generation for apk packages was faulty. For example the purl for an alpine image busybox package was pkg:apk/alpine/[email protected] instead of the correct pkg:alpine/[email protected]. Note that "apk" type packages are not defined for purl yet, specifically, but OSSINDEX uses the pkg:alpine[1] notation and purl has purposely chosen not to use "apk" as an identifier due to a known conflict with Android which also uses the term apk[2]. [1] https://ossindex.sonatype.org/component/pkg:alpine/[email protected] [2] package-url/purl-spec#159 (comment) Resolves: #1131 Signed-off-by: Thiéfaine Mercier <[email protected]> Signed-off-by: Rose Judge <[email protected]>
1 parent a04208f commit dd8a062

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tern/formats/cyclonedx/cyclonedxjson/package_helpers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ def get_package_dict(os_guess, package):
2626
purl_name = cyclonedx_common.get_purl_name(package.name,
2727
package.pkg_format)
2828
purl = PackageURL(purl_type, purl_namespace, purl_name, package.version)
29+
if purl_type == "apk":
30+
# Update purl to remove "apk" from the string
31+
purl = PackageURL(purl_namespace, purl_name, package.version)
2932
package_dict['purl'] = str(purl)
3033

3134
if package.pkg_license:

0 commit comments

Comments
 (0)