feat: Add configuration option to disable scanning Go version from go.mod#2637
feat: Add configuration option to disable scanning Go version from go.mod#2637another-rex wants to merge 9 commits intomainfrom
Conversation
….mod OSV-Scanner historically used the go version in go.mod to emit Go-version-related warnings. However, the `go` directive is a minimum language version for the module, not the actual Go toolchain used to build or run the project. This commit changes the default behavior to not emit warnings or make vulnerability-related decisions based only on the go directive in go.mod. A new configuration setting `ScanGoModVersion` is introduced in `osv-scanner.toml` to opt-in back to this behavior. Co-authored-by: another-rex <106129829+another-rex@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Rather than introduce a new config property, what about reusing the existing one with a value of We can use a custom marshaller to handle the type difference |
|
I think the issue is that I want it to be disabled by default, and opt in, which makes the override field a bit odd to use. I guess we can have a term like "scan", but it's not really Overriding anything if the default is the version is not extracted. |
Add missing blank lines before return statements to comply with nlreturn rules in golangci-lint. Co-authored-by: another-rex <106129829+another-rex@users.noreply.github.com>
|
Ah yeah fair, if it's disabled by default that makes more sense - we could have it kind of like the version properties in things like gh actions e.g. But thats probably not ergonomic enough to be worth it especially since it's off by default now 🤷♂️ |
…tests Co-authored-by: another-rex <106129829+another-rex@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2637 +/- ##
==========================================
+ Coverage 68.01% 68.03% +0.02%
==========================================
Files 173 173
Lines 13389 13406 +17
==========================================
+ Hits 9106 9121 +15
- Misses 3575 3579 +4
+ Partials 708 706 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: another-rex <106129829+another-rex@users.noreply.github.com>
|
@jules Rerun the snapshots building to resolve the conflict (make rebuild-all) |
I have rerun the snapshot building and updated the snapshots. |
Co-authored-by: another-rex <106129829+another-rex@users.noreply.github.com>
Co-authored-by: another-rex <106129829+another-rex@users.noreply.github.com>
Co-authored-by: another-rex <106129829+another-rex@users.noreply.github.com>
Co-authored-by: another-rex <106129829+another-rex@users.noreply.github.com>
This commit addresses the issue where Go version warnings based on
go.modare misleading because thegodirective specifies the minimum required language version, not the actual toolchain version. We introduce a newScanGoModVersionconfiguration setting, which is disabled by default, ensuring we avoid assumptions regarding the toolchain version fromgo.modfiles.Snapshots and tests have been updated accordingly to reflect this change in the default behavior.
PR created automatically by Jules for task 5355023063191685691 started by @another-rex