-
Notifications
You must be signed in to change notification settings - Fork 25
feat: support for stripped/cgo go binaries #728
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
base: main
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍
|
| try { | ||
| this.matchFilesToModules(new LineTable(pclnTab.data).go12MapFiles()); | ||
| } catch (err) { | ||
| // If pclntab parsing fails, continue with module-only reporting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit/suggestion: should we still log or print to debug if it fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, definitely! thanks for suggesting it!
parker-snyk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment on logging, but otherwise lgtm!
Make .gopclntab optional when scanning Go binaries. When the section is missing (stripped/CGo builds), report module-level dependencies instead of failing. This enables scanning of previously undetectable binaries.
PR Reviewer Guide 🔍
|
dan-arpino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like some minor linting errors, other than that, looks good!
What does this PR do?
This PR enables scanning for Go binaries that are missing the .gopclntab section:
Previously, these binaries caused scanning failures with error "no pcln tab present in Go binary", resulting in 0 dependencies detected and all vulnerabilities missed.
Where should the reviewer start?
For getting a little bit of context , start here.
The main code change starts here : if .gopclntab is undefined -> module.packages is empty-> so we add the module as dependency to the depgraph.
How should this be manually tested?
Test the fix on a public image that embeds stripped/CGO binaries in the filesystem:
Any background context you want to provide?
.gopclntab - shows what is compiled into the binary(build output) → can help to build 100% accurate dependency graphs
.go.buildinfo - shows what modules were available during build, there is not way to tell which have compiled → can add false positives
How we use them?
With both .go.buildinfo available and .gopclntab available:
`
`
With only .go.buildinfo context (stripped binaries):
`
What are the relevant tickets?
CN-421
Screenshots
Additional questions