Skip to content

Commit 75e4830

Browse files
julieqiugopherbot
authored andcommitted
all: update docs
Update docs for packages cmd/govulncheck, internal/govulncheck, and scan. Change-Id: If30b107f6fb1166cc8be8aa6c51cffa37bdac7e6 Reviewed-on: https://go-review.googlesource.com/c/vuln/+/508917 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com> Auto-Submit: Julie Qiu <julieqiu@google.com> Reviewed-by: Julie Qiu <julieqiu@google.com> Run-TryBot: Julie Qiu <julieqiu@google.com>
1 parent 5ae5761 commit 75e4830

File tree

5 files changed

+16
-37
lines changed

5 files changed

+16
-37
lines changed

cmd/govulncheck/doc.go

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ To control which files are processed, use the -tags flag to provide a
4141
comma-separated list of build tags, and the -test flag to indicate that test
4242
files should be included.
4343
44+
To include more detailed stack traces, pass -show=traces, this will cause it to
45+
print the full call stack for each entry.
46+
4447
To run govulncheck on a compiled binary, pass it the path to the binary file
4548
with the -mode=binary flag:
4649
@@ -50,36 +53,9 @@ Govulncheck uses the binary's symbol information to find mentions of vulnerable
5053
functions. Its output omits call stacks, which require source code analysis.
5154
5255
Govulncheck exits successfully (exit code 0) if there are no vulnerabilities,
53-
and exits unsuccessfully if there are. It also exits successfully if -json flag
56+
and exits unsuccessfully if there are. It also exits successfully if the -json flag
5457
is provided, regardless of the number of detected vulnerabilities.
5558
56-
# Flags
57-
58-
A few flags control govulncheck's behavior.
59-
60-
The -C flag causes govulncheck to change its working directory to the provided
61-
directory before running. Any patterns or files named on the command line are
62-
interpreted after changing directories.
63-
64-
The -db flag causes govulncheck to read from the specified database, which must
65-
implement the specification at https://go.dev/security/vuln/database. By
66-
default, govulncheck fetches vulnerability data from https://vuln.go.dev.
67-
68-
The -json flag causes govulncheck to print its output as a JSON object
69-
corresponding to the type [golang.org/x/vuln/internal/govulncheck.Result]. The
70-
exit code of govulncheck is 0 when this flag is provided.
71-
72-
The -mode flag causes govulncheck to run source or binary analysis. By default,
73-
govulnchecks runs source analysis.
74-
75-
The -tags flag accepts a comma-separated list of build tags to control which
76-
files should be included in loaded packages for source analysis.
77-
78-
The -test flag causes govulncheck to include test files in the source analysis.
79-
80-
The -v flag causes govulncheck to output more information when run on source.
81-
It has no effect when run on a binary.
82-
8359
# Limitations
8460
8561
Govulncheck has these limitations:
@@ -88,16 +64,13 @@ Govulncheck has these limitations:
8864
which may result in false positives or inaccurate call stacks in some cases.
8965
- Calls to functions made using package reflect are not visible to static
9066
analysis. Vulnerable code reachable only through those calls will not be
91-
reported.
67+
reported. Use of the unsafe package may result in false negatives.
9268
- Because Go binaries do not contain detailed call information, govulncheck
9369
cannot show the call graphs for detected vulnerabilities. It may also
9470
report false positives for code that is in the binary but unreachable.
95-
- There is no support for silencing vulnerability findings.
71+
- There is no support for silencing vulnerability findings. See https://go.dev/issue/61211 for
72+
updates.
9673
- Govulncheck only reads binaries compiled with Go 1.18 and later.
97-
- Govulncheck only reports vulnerabilities that apply to the current Go
98-
version. For example, a standard library vulnerability that only applies for
99-
Go 1.18 will not be reported if the current Go version is 1.19. See
100-
https://go.dev/issue/54841 for updates to this limitation.
10174
- For binaries where the symbol information cannot be extracted, govulncheck
10275
reports vulnerabilities for all modules on which the binary depends.
10376

internal/govulncheck/result.go renamed to internal/govulncheck/govulncheck.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type Config struct {
5252
// vulnerabilities.
5353
GoVersion string `json:"go_version,omitempty"`
5454

55-
// ScanLevel instructs vulncheck to analyze at a specific level of detail.
55+
// ScanLevel instructs govulncheck to analyze at a specific level of detail.
5656
// Valid values include module, package and symbol.
5757
ScanLevel ScanLevel `json:"scan_level,omitempty"`
5858
}
@@ -154,5 +154,5 @@ const (
154154
)
155155

156156
// WantSymbols can be used to check whether the scan level is one that is able
157-
// to generate symbol called findings.
157+
// to generate symbols called findings.
158158
func (l ScanLevel) WantSymbols() bool { return l == scanLevelSymbol }
File renamed without changes.

scan/scan.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// Package scan provides functionality for running govulncheck.
5+
/*
6+
Package scan provides functionality for running govulncheck.
7+
8+
See [cmd/govulncheck/main.go] as a usage example.
9+
10+
[cmd/govulncheck/main.go]: https://go.googlesource.com/vuln/+/master/cmd/govulncheck/main.go
11+
*/
612
package scan
713

814
import (

0 commit comments

Comments
 (0)