-
Notifications
You must be signed in to change notification settings - Fork 508
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
🐛 enable osv-scanner Go call analysis #3893
🐛 enable osv-scanner Go call analysis #3893
Conversation
Projects that dont call the vulnerable functions aren't included in the build Signed-off-by: Spencer Schrock <[email protected]>
@hogo6002 would you mind taking a look at this? I couldn't find a way of asking Additionally in the commit message I claim "uncalled vulnerable functions aren't included in the build", which I think is true for Go, but figured someone on OSV would know better. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3893 +/- ##
==========================================
- Coverage 75.11% 70.52% -4.59%
==========================================
Files 234 234
Lines 15860 15867 +7
==========================================
- Hits 11913 11190 -723
- Misses 3187 3967 +780
+ Partials 760 710 -50 |
/scdiff generate Vulnerabilities |
osv-scanner doesn't throw VulnerabilitiesFoundErr if only uncalled vulnerabilities are found. For repos that have a mix of called and uncalled, we'll need to check each one. Signed-off-by: Spencer Schrock <[email protected]>
Hi Spencer,
Yes, right now, the stable call analysis only contains Go. All stable call analysis states: https://github.com/google/osv-scanner/blob/ef3a2a478d4d7460f80a7fe962b14a3d75a3095f/cmd/osv-scanner/scan/callanalysis_parser.go#L3
Even with go call analysis on, osvscanner.DoScan still returns both called and uncalled vulns. |
I'm trying to create a local test. A project which uses an old version of Go intentionally. package main
import (
"log"
"net/http"
)
func main() {
err := http.ListenAndServe(":8080", nil)
if err != nil {
log.Fatal(err)
}
} the example
But $ go version
go version go1.22.0 linux/amd64
$ osv-scanner -r .
Scanning dir .
Scanned /tmp/go/go.mod file and found 1 package
Uncalled vulnerabilities
│ https://osv.dev/GO-2023-2375 │ │ Go │ stdlib │ 1.19 │ go.mod │
│ https://osv.dev/GO-2023-2041 │ │ Go │ stdlib │ 1.19 │ go.mod │
│ https://osv.dev/GO-2023-2043 │ │ Go │ stdlib │ 1.19 │ go.mod │
│ https://osv.dev/GO-2023-2102 │ │ Go │ stdlib │ 1.19 │ go.mod │
│ https://osv.dev/GO-2023-2185 │ │ Go │ stdlib │ 1.19 │ go.mod │
│ https://osv.dev/GO-2023-2186 │ │ Go │ stdlib │ 1.19 │ go.mod │
│ https://osv.dev/GO-2023-2382 │ │ Go │ stdlib │ 1.19 │ go.mod │ Vs if I use an older Go toolchain (example go.mod is still 1.19). $ go version
go version go1.21.2 linux/amd64
$ osv-scanner -r .
Scanning dir .
Scanned /tmp/go/go.mod file and found 1 package
(called vulnerabilities section)
│ https://osv.dev/GO-2023-2102 │ │ Go │ stdlib │ 1.19 │ go.mod │
│ https://osv.dev/GO-2023-2185 │ │ Go │ stdlib │ 1.19 │ go.mod │
│ https://osv.dev/GO-2023-2382 │ │ Go │ stdlib │ 1.19 │ go.mod │
Uncalled vulnerabilities
│ https://osv.dev/GO-2023-2375 │ │ Go │ stdlib │ 1.19 │ go.mod │
│ https://osv.dev/GO-2023-2041 │ │ Go │ stdlib │ 1.19 │ go.mod │
│ https://osv.dev/GO-2023-2043 │ │ Go │ stdlib │ 1.19 │ go.mod │
│ https://osv.dev/GO-2023-2186 │ │ Go │ stdlib │ 1.19 │ go.mod │ Just trying to understand this behavior before enabling it. As our weekly scan runs with the latest version of the Go toolchain |
CallAnalysisStates: map[string]bool{ | ||
"go": true, | ||
}, |
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.
putting a temporary merge hold while discussing exactly how this would work
Remove OpenSSF Scorecard badge from README.md until this OpenSSF scorecard bug is fixed: ossf/scorecard#3891 The fix is in progress at OpenSSF Scorecard: ossf/scorecard#3893
@spencerschrock Thanks for reporting this issue. We just merged a fix PR (google/osv-scanner#818) for it. The installed Go version does not matter to osv-scanner when generating the reachability results. |
Is osv-scanner planning on a patch release, or should Scorecard consider doing a pseudo-version update to pull the patch in?
Scorecard currently assumes all reported OSV vulns are called, so I think that would be identical to how things are now. |
Yes, we will do a release this week. |
Signed-off-by: Spencer Schrock <[email protected]>
see google/osv-scanner#818 for details Signed-off-by: Spencer Schrock <[email protected]>
So this works locally, but when run as a docker image (which is what the cron and scorecard action will do), enabling call analysis doesn't actually do anything because the docker image only has the scorecard binary, not a copy of the Go binary |
Remove OpenSSF Scorecard badge from README.md until this OpenSSF scorecard bug is fixed: ossf/scorecard#3891 The fix is in progress at OpenSSF Scorecard: ossf/scorecard#3893
What kind of change does this PR introduce?
bug fix
What is the current behavior?
The
Vulnerabilities
check deducts for Go vulnerabilities which aren't called.What is the new behavior (if this is a feature change)?**
osv-scanner
Go call analysis is enabled. Uncalled vulnerable functions aren't included in the build, and don't affect the score.I'm not sure there's a great way of testing this via unit tests at least. Perhaps an e2e test?
Which issue(s) this PR fixes
Fixes #3891
Special notes for your reviewer
Testing locally on the original repo seems to have resolved the issue.
Does this PR introduce a user-facing change?
For user-facing changes, please add a concise, human-readable release note to
the
release-note
(In particular, describe what changes users might need to make in their
application as a result of this pull request.)