Skip to content

Commit

Permalink
all: use new version of govulncheck
Browse files Browse the repository at this point in the history
Change-Id: I55fff6f6ea401dbda93374815cf27cb9fd517da8
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/643175
Auto-Submit: Zvonimir Pavlinovic <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Jonathan Amsterdam <[email protected]>
  • Loading branch information
zpavlinovic authored and gopherbot committed Jan 16, 2025
1 parent 3659796 commit 121801a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
golang.org/x/oauth2 v0.25.0
golang.org/x/sync v0.10.0
golang.org/x/tools v0.29.0
golang.org/x/vuln v1.1.3
golang.org/x/vuln v1.1.4
google.golang.org/api v0.132.0
google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130
google.golang.org/grpc v1.56.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,8 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588=
golang.org/x/vuln v1.1.3 h1:NPGnvPOTgnjBc9HTaUx+nj+EaUYxl5SJOWqaDYGaFYw=
golang.org/x/vuln v1.1.3/go.mod h1:7Le6Fadm5FOqE9C926BCD0g12NWyhg7cxV4BwcPFuNY=
golang.org/x/vuln v1.1.4 h1:Ju8QsuyhX3Hk8ma3CesTbO8vfJD9EvUBgHvkxHBzj0I=
golang.org/x/vuln v1.1.4/go.mod h1:F+45wmU18ym/ca5PLTPLsSzr2KppzswxPP603ldA67s=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
4 changes: 4 additions & 0 deletions internal/govulncheck/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ func (h *MetricsHandler) Progress(p *govulncheckapi.Progress) error {
return nil
}

func (h *MetricsHandler) SBOM(sbom *govulncheckapi.SBOM) error {
return nil
}

func (h *MetricsHandler) OSV(e *osv.Entry) error {
h.osvs[e.ID] = e
return nil
Expand Down
3 changes: 3 additions & 0 deletions internal/govulncheckapi/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ type Handler interface {
// Config communicates introductory message to the user.
Config(config *Config) error

// SBOM shows information about what govulncheck is scanning.
SBOM(sbom *SBOM) error

// Progress is called to display a progress message.
Progress(progress *Progress) error

Expand Down
24 changes: 24 additions & 0 deletions internal/govulncheckapi/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
type Message struct {
Config *Config `json:"config,omitempty"`
Progress *Progress `json:"progress,omitempty"`
SBOM *SBOM `json:"SBOM,omitempty"`
OSV *osv.Entry `json:"osv,omitempty"`
Finding *Finding `json:"finding,omitempty"`
}
Expand Down Expand Up @@ -53,6 +54,29 @@ type Config struct {
ScanLevel ScanLevel `json:"scan_level,omitempty"`
}

// SBOM contains minimal information about the artifacts govulncheck is scanning.
type SBOM struct {
// The go version used by govulncheck when scanning, which also defines
// the version of the standard library used for detecting vulns.
GoVersion string `json:"go_version,omitempty"`

// The set of modules included in the scan.
Modules []*Module `json:"modules,omitempty"`

// The roots of the scan, as package paths.
// For binaries, this will be the main package.
// For source code, this will be the packages matching the provided package patterns.
Roots []string `json:"roots,omitempty"`
}

type Module struct {
// The full module path.
Path string `json:"path,omitempty"`

// The version of the module.
Version string `json:"version,omitempty"`
}

// Progress messages are informational only, intended to allow users to monitor
// the progress of a long running scan.
// A stream must remain fully valid and able to be interpreted with all progress
Expand Down

0 comments on commit 121801a

Please sign in to comment.