Show binary exports, entrypoint, and imports#2626
Merged
Conversation
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
kzantow
approved these changes
Mar 12, 2024
| func findMachoFeatures(data *file.Executable, reader unionreader.UnionReader) error { | ||
| // TODO: support security features | ||
|
|
||
| // TODO: support multi-architecture binaries |
Contributor
There was a problem hiding this comment.
Isn't this what the UnionReader is for?
Contributor
Author
There was a problem hiding this comment.
no a union reader only makes the reader easier to use for seeking and such:
type UnionReader interface {
io.Reader
io.ReaderAt
io.Seeker
io.Closer
}Where as we could be individually unwrapping the multiple binaries from "universal" or multi-architecture binaries: https://github.com/anchore/go-macholibre/blob/5df1434a0b50a4fe3e1dae035d10d4c977369e43/universal_binary.go#L143 .
I've descoped this from this particular PR.
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
brian-ebarb
pushed a commit
to brian-ebarb/syft
that referenced
this pull request
Mar 13, 2024
show binary exports, entrypoint, and imports for macho, elf, and pe formats Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Signed-off-by: Brian Ebarb <ebarb.brian@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partially implements #661
This PR adds the following indications to the
file.Executableobject:hasEntrypointdenotes if the binary is self-executablehasExportsdenotes that the binary can be used as a libraryimportsLibrariesdenotes which dynamic libraries a binary needsWhy not just indicate
isLibrary? Mainly because some executable formats can support a binary being both a library and a self-executing application simultaneously:(anything that isn't U is an export)
Why not make relationships between binary files instead of declaring the imports as attributes on the file object? There is some discussion about this, but this PR only goes so far; no new relationships are being added in this PR, but it is important to be able to know:
This functionality has been implemented for ELF, Mach-o, and PE binary formats.