mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 06:56:40 +01:00
Canonicalize Ghostscript CPE/PURL for ghostscript packages from PE Binaries (#4308)
* binary(pe): canonicalize Ghostscript CPE to artifex:ghostscript and add generic purl for PE (#4275)\n\n- Detect Ghostscript via PE version resources and set purl pkg:generic/ghostscript@<version>\n- Add PE-specific CPE candidates: vendor 'artifex', product 'ghostscript'\n- Add focused unit tests for purl and CPE generation Signed-off-by: kdt523 <krushna.datir231@vit.edu> * fix: gofmt formatting for static analysis pass (pe-ghostscript-cpe-purl-4275) Signed-off-by: kdt523 <krushna.datir231@vit.edu> --------- Signed-off-by: kdt523 <krushna.datir231@vit.edu>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/anchore/syft/syft/file"
|
||||
)
|
||||
|
||||
func TestGhostscriptPEGeneratesGenericPURL(t *testing.T) {
|
||||
vr := map[string]string{
|
||||
"CompanyName": "Artifex Software, Inc.",
|
||||
"ProductName": "GPL Ghostscript",
|
||||
"FileDescription": "Ghostscript Interpreter",
|
||||
"ProductVersion": "9.54.0",
|
||||
}
|
||||
|
||||
loc := file.NewLocation("/usr/bin/gswin64c.exe")
|
||||
p := newPEPackage(vr, loc)
|
||||
|
||||
expected := "pkg:generic/ghostscript@9.54.0"
|
||||
if p.PURL != expected {
|
||||
t.Fatalf("expected purl %q, got %q", expected, p.PURL)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user