Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress executable parsing issues #2614

Merged
merged 2 commits into from
Feb 9, 2024
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
12 changes: 7 additions & 5 deletions syft/file/cataloger/executable/cataloger.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func processExecutable(loc file.Location, reader unionreader.UnionReader) (*file

securityFeatures, err := findSecurityFeatures(format, reader)
if err != nil {
log.WithFields("error", err).Warnf("unable to determine security features for %q", loc.RealPath)
log.WithFields("error", err).Tracef("unable to determine security features for %q", loc.RealPath)
return nil, nil
}

Expand Down Expand Up @@ -228,10 +228,12 @@ func findSecurityFeatures(format file.ExecutableFormat, reader unionreader.Union
switch format { //nolint: gocritic
case file.ELF:
return findELFSecurityFeatures(reader) //nolint: gocritic
// case file.PE:
// return findPESecurityFeatures(reader)
// case file.MachO:
// return findMachOSecurityFeatures(reader)
case file.PE:
// return findPESecurityFeatures(reader)
return nil, nil
case file.MachO:
// return findMachOSecurityFeatures(reader)
return nil, nil
}
return nil, fmt.Errorf("unsupported executable format: %q", format)
}
6 changes: 3 additions & 3 deletions syft/file/cataloger/executable/elf.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func hasAnyDynamicSymbols(file *elf.File, symbolNames ...string) *bool {
dynSyms, err := file.DynamicSymbols()
if err != nil {
// TODO: known-unknowns
log.WithFields("error", err).Warn("unable to read dynamic symbols from elf file")
log.WithFields("error", err).Trace("unable to read dynamic symbols from elf file")
return nil
}

Expand Down Expand Up @@ -112,7 +112,7 @@ func hasElfDynFlag(f *elf.File, flag elf.DynFlag) bool {
vals, err := f.DynValue(elf.DT_FLAGS)
if err != nil {
// TODO: known-unknowns
log.WithFields("error", err).Warn("unable to read DT_FLAGS from elf file")
log.WithFields("error", err).Trace("unable to read DT_FLAGS from elf file")
return false
}
for _, val := range vals {
Expand All @@ -127,7 +127,7 @@ func hasElfDynFlag1(f *elf.File, flag elf.DynFlag1) bool {
vals, err := f.DynValue(elf.DT_FLAGS_1)
if err != nil {
// TODO: known-unknowns
log.WithFields("error", err).Warn("unable to read DT_FLAGS_1 from elf file")
log.WithFields("error", err).Trace("unable to read DT_FLAGS_1 from elf file")
return false
}
for _, val := range vals {
Expand Down
Loading