mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 15:06:36 +01:00
fix: PE case-insensitive extensions (Win32/ISO 9660 compatibility) (#4996)
* fix: PE case-insensitive extensions (Win32/ISO 9660 compatibility) Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * add tests Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * expand cases to bpl files and surrounding catalogers Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
co-authored by
Alex Goodman
parent
76ede661db
commit
987ae7f26a
@@ -1055,6 +1055,9 @@ catalogers:
|
||||
detector: # AUTO-GENERATED
|
||||
method: glob # AUTO-GENERATED
|
||||
criteria: # AUTO-GENERATED
|
||||
- '**/*.DLL'
|
||||
- '**/*.EXE'
|
||||
- '**/*.BPL'
|
||||
- '**/*.dll'
|
||||
- '**/*.exe'
|
||||
- '**/*.bpl'
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
// BPL (Borland Package Library) files are PE-format binaries used by Delphi and C++Builder.
|
||||
func NewPEPackageCataloger() pkg.Cataloger {
|
||||
return generic.NewCataloger("pe-binary-package-cataloger").
|
||||
WithParserByGlobs(parsePE, "**/*.dll", "**/*.exe", "**/*.bpl")
|
||||
WithParserByGlobs(parsePE, "**/*.DLL", "**/*.EXE", "**/*.BPL", "**/*.dll", "**/*.exe", "**/*.bpl")
|
||||
}
|
||||
|
||||
func parsePE(_ context.Context, _ file.Resolver, _ *generic.Environment, reader file.LocationReadCloser) ([]pkg.Package, []artifact.Relationship, error) {
|
||||
|
||||
@@ -70,12 +70,16 @@ func Test_PEPackageCataloger_Globs(t *testing.T) {
|
||||
expected []string
|
||||
}{
|
||||
{
|
||||
name: "obtain PE binary files (dll, exe, bpl)",
|
||||
name: "obtain PE binary files (dll, exe, bpl), including uppercase extensions",
|
||||
fixture: "testdata/glob-paths",
|
||||
expected: []string{
|
||||
"src/library.dll",
|
||||
"src/program.exe",
|
||||
"src/archive.bpl",
|
||||
// uppercase extensions appear on Windows/ISO 9660 filesystems and must also match
|
||||
"src/winlibrary.DLL",
|
||||
"src/winprogram.EXE",
|
||||
"src/winarchive.BPL",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
bogus PE contents
|
||||
@@ -0,0 +1 @@
|
||||
bogus PE contents
|
||||
@@ -0,0 +1 @@
|
||||
bogus PE contents
|
||||
Reference in New Issue
Block a user