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

fix: apply go version override to _all_ instances of the stdlib #1278

Merged
merged 1 commit into from
Sep 30, 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
41 changes: 41 additions & 0 deletions cmd/osv-scanner/__snapshots__/main_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,47 @@ Scanned <rootdir>/fixtures/go-project/go.mod file and found 1 package

---

[TestRun/Go_project_with_an_overridden_go_version,_recursive - 1]
Scanning dir ./fixtures/go-project
Scanned <rootdir>/fixtures/go-project/go.mod file and found 1 package
Scanned <rootdir>/fixtures/go-project/nested/go.mod file and found 1 package
+------------------------------+------+-----------+---------+---------+-----------------------------------+
| OSV URL | CVSS | ECOSYSTEM | PACKAGE | VERSION | SOURCE |
+------------------------------+------+-----------+---------+---------+-----------------------------------+
| Uncalled vulnerabilities | | | | | |
+------------------------------+------+-----------+---------+---------+-----------------------------------+
| https://osv.dev/GO-2024-2598 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-2599 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-2600 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-2609 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-2610 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-2687 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-2887 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-2888 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-2963 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-3105 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-3106 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-3107 | | Go | stdlib | 1.21.7 | fixtures/go-project/go.mod |
| https://osv.dev/GO-2024-2598 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
| https://osv.dev/GO-2024-2599 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
| https://osv.dev/GO-2024-2600 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
| https://osv.dev/GO-2024-2609 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
| https://osv.dev/GO-2024-2610 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
| https://osv.dev/GO-2024-2687 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
| https://osv.dev/GO-2024-2887 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
| https://osv.dev/GO-2024-2888 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
| https://osv.dev/GO-2024-2963 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
| https://osv.dev/GO-2024-3105 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
| https://osv.dev/GO-2024-3106 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
| https://osv.dev/GO-2024-3107 | | Go | stdlib | 1.21.7 | fixtures/go-project/nested/go.mod |
+------------------------------+------+-----------+---------+---------+-----------------------------------+

---

[TestRun/Go_project_with_an_overridden_go_version,_recursive - 2]

---

[TestRun/PURL_SBOM_case_sensitivity_(api) - 1]
Scanning dir ./fixtures/sbom-insecure/alpine.cdx.xml
Scanned <rootdir>/fixtures/sbom-insecure/alpine.cdx.xml as CycloneDX SBOM and found 14 packages
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GoVersionOverride = "1.21.7"
3 changes: 3 additions & 0 deletions cmd/osv-scanner/fixtures/go-project/nested/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/ossf-tests/osv-e2e

go 1.19
5 changes: 5 additions & 0 deletions cmd/osv-scanner/fixtures/go-project/nested/osv-scanner.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[[PackageOverrides]]
name = "stdlib"
ecosystem = "Go"
ignore = true
reason = "This is an intentionally vulnerable test project"
6 changes: 6 additions & 0 deletions cmd/osv-scanner/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ func TestRun(t *testing.T) {
args: []string{"", "--config=./fixtures/go-project/go-version-config.toml", "./fixtures/go-project"},
exit: 0,
},
// Go project with an overridden go version, recursive
{
name: "Go project with an overridden go version, recursive",
args: []string{"", "--config=./fixtures/go-project/go-version-config.toml", "-r", "./fixtures/go-project"},
exit: 0,
},
// broad config file that overrides a whole ecosystem
{
name: "config file can be broad",
Expand Down
2 changes: 1 addition & 1 deletion pkg/osvscanner/osvscanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ func overrideGoVersion(r reporter.Reporter, packages []scannedPackage, configMan
packages[i].Version = configToUse.GoVersionOverride
}

break
continue
}
}
}