Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions syft/pkg/cataloger/binary/capabilities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,9 @@ catalogers:
detector: # AUTO-GENERATED
method: glob # AUTO-GENERATED
criteria: # AUTO-GENERATED
- '**/*.DLL'
- '**/*.EXE'
- '**/*.BPL'
- '**/*.dll'
- '**/*.exe'
- '**/*.bpl'
Expand Down
2 changes: 1 addition & 1 deletion syft/pkg/cataloger/binary/pe_package_cataloger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion syft/pkg/cataloger/binary/pe_package_cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bogus PE contents
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bogus PE contents
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bogus PE contents
8 changes: 8 additions & 0 deletions syft/pkg/cataloger/dotnet/capabilities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ catalogers:
- '**/*.deps.json'
- '**/*.dll'
- '**/*.exe'
- '**/*.bpl'
- '**/*.DLL'
- '**/*.EXE'
- '**/*.BPL'
metadata_types: # AUTO-GENERATED
- pkg.DotnetDepsEntry
- pkg.DotnetPortableExecutableEntry
Expand Down Expand Up @@ -173,6 +177,10 @@ catalogers:
criteria:
- '**/*.dll'
- '**/*.exe'
- '**/*.bpl'
- '**/*.DLL'
- '**/*.EXE'
- '**/*.BPL'
metadata_types: # AUTO-GENERATED
- pkg.DotnetPortableExecutableEntry
package_types: # AUTO-GENERATED
Expand Down
8 changes: 8 additions & 0 deletions syft/pkg/cataloger/dotnet/cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ func TestCataloger_Globs(t *testing.T) {
"src/something.bpl",
"src/something.dll",
"src/something.exe",
// uppercase extensions appear on Windows/ISO 9660 filesystems and must also match
"src/winsomething.DLL",
"src/winsomething.EXE",
"src/winsomething.BPL",
},
},
{
Expand All @@ -47,6 +51,10 @@ func TestCataloger_Globs(t *testing.T) {
"src/something.deps.json",
"src/something.dll",
"src/something.exe",
// uppercase extensions appear on Windows/ISO 9660 filesystems and must also match
"src/winsomething.DLL",
"src/winsomething.EXE",
"src/winsomething.BPL",
},
// the binary cataloger probes executables by MIME type to find embedded bundles,
// but the glob fixtures aren't real binaries so those queries go unfulfilled
Expand Down
6 changes: 5 additions & 1 deletion syft/pkg/cataloger/dotnet/deps_binary_cataloger.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const (
dllGlob = "**/*.dll"
exeGlob = "**/*.exe"
bplGlob = "**/*.bpl"
// uppercase variants match PE files on case-preserving Windows/ISO 9660 filesystems (doublestar globs are case-sensitive)
dllGlobUpper = "**/*.DLL"
exeGlobUpper = "**/*.EXE"
bplGlobUpper = "**/*.BPL"
)

var elfMagic = []byte{0x7f, 'E', 'L', 'F'}
Expand Down Expand Up @@ -483,7 +487,7 @@ func readDepsJSON(resolver file.Resolver, loc file.Location) (*depsJSON, error)

// findPEFiles locates and parses all PE files (dll/exe).
func findPEFiles(resolver file.Resolver) ([]logicalPE, error, error) {
peLocs, err := resolver.FilesByGlob(dllGlob, exeGlob, bplGlob)
peLocs, err := resolver.FilesByGlob(dllGlob, exeGlob, bplGlob, dllGlobUpper, exeGlobUpper, bplGlobUpper)
if err != nil {
return nil, nil, fmt.Errorf("unable to find PE files: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bogus PE contents
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bogus PE contents
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bogus PE contents
Loading