Граф коммитов

300 Коммитов

Автор SHA1 Сообщение Дата
Tatiana Bradley a460ba8ff6 cmd/vulnreport: fix excluded folder bug
Fix bug in which excluded reports would be published to the wrong
folder. This was accidentally introduced in a recent refactor
and no reports were actually published to the wrong folder (this would
have been caught before submit if it had occurred).

Change-Id: Icc9eb99b2ceb185310e99eaa39e45072e0ae6c80
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/590280
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-05 15:09:27 +00:00
Tatiana Bradley c3c93c09d3 cmd/vulnreport: remove return value from xref
Remove error return value from xref, which always returns nil.

(Caught by unparam and blocking deploy of vulndb)

Change-Id: I4c9423f0d333d7beb9422ee558ed83f3dd99aebf
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/590115
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-03 22:38:03 +00:00
Tatiana Bradley f714a15249 cmd/vulnreport: refactor commands to unify processing logs
Change-Id: Iffac3dec16c30c3384ab59955a4d5e53f6a6fbfe
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/590037
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-03 20:52:30 +00:00
Tatiana Bradley b1733dedf4 cmd/vulnreport: delete unused command vulnreport duplicates
Change-Id: I78ccf562b43bfe372a21452afb0312efd6948ca9
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/590036
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-03 20:51:49 +00:00
Tatiana Bradley 31e9628156 cmd/vulnreport: add no-arg version of vulnreport commit
With no arguments, "vulnreport commit" now individually commits all
reports that have been added/changed (according to git status).
(To commit them all as a single commit, use "vulnreport -batch commit").

The flag "-status=<REVIEW_STATUS>" can additionally be used
to only commit reports with a certain review status.

Change-Id: I4efb4e866166b6153d556409408021dc861656fb
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/590035
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-03 20:51:40 +00:00
Tatiana Bradley 7aa642d280 cmd/vulnreport: add a check for basic reference URL existence
Adds a check to "vulnreport fix" that errors if any URLs in the
"references" section return an error or status 404 on HTTP HEAD.
We don't check for other status codes yet.

An experiment to error on all non-200 status codes brought up some
ambiguous cases where the link is still viewable in a browser, e.g.:
    - 429 Too Many Requests (https://vuldb.com/?id.256304)
    - 503 Service Unavailable (http://blog.recurity-labs.com/2017-08-10/scm-vulns):
    - 403 Forbidden (https://www.sap.com/documents/2022/02/fa865ea4-167e-0010-bca6-c68f7e60039b.html)

For now, this is a fix check and not a lint check, meaning it only
applies to new reports, and can technically be ignored (by manually
creating a CL that adds the report).

This CL also deletes existing URLs in the corpus that don't exist
according to this check.

Change-Id: Id14fb79fc2f2c2d4c8145fdc88d11aa33708c94b
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/588761
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-03 20:51:31 +00:00
Tatiana Bradley 9840931d1e cmd/vulnreport: automatically decide whether to create REVIEWED or UNREVIEWED report
Command vulnreport create now decides whether to generate a REVIEWED
or UNREVIEWED report based on issue's labels.

This can be overridden with flag "-status=<REVIEW_STATUS>". The "unreviewed"
flag is removed.

Change-Id: I8f8b808c6f9bbcaeb0dc176fb6cb875b8f9ccee4
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/587976
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-23 20:24:39 +00:00
Tatiana Bradley 917c76bfbc cmd/vulnreport: add label triaged
Update the vulnreport triage command to label any issues it triages
as "triaged", and skip issues that are already labeled as such.
(The flag "-f" overrides the skip).

This allows the triager to simply run "vulnreport triage" to triage all
untriaged issues.

Change-Id: I24611166d972c46100b1e8fd38bed1fb87071d11
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/587915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
2024-05-23 17:08:53 +00:00
Tatiana Bradley 440437435d internal/report: move TODO check to lint
Move the check for outstanding TODOs from the vulnreport
fix function to the report.Lint function.

Change-Id: I909dae66400423453c6178ec452462e0cf1f4273
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/585417
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-20 16:04:59 +00:00
Tatiana Bradley 86f3a070e2 cmd/vulnreport: add flag -batch to commit
Flag -batch causes vulnreport commit to (attempt to) create a single
commit that commits all reports indicated by its arguments, instead
of committing each report separately.

Change-Id: Ib0c9b3d52c7654ac952e78ca042ce5f29b98f48a
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/585439
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-20 16:04:42 +00:00
Tatiana Bradley 65abc06ddc cmd/vulnreport: add flag -unreviewed to create
Flag -unreviewed causes create to generate unreviewed reports
(with no description and no TODOs).

Change-Id: If60eeb22983b3b6480d440de740e6eedf3fcf8d9
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/585438
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-20 16:04:28 +00:00
Tatiana Bradley a74f2d7941 internal/report: make UNREVIEWED default status in New
In report.New, make UNREVIEWED the default status. This
can be overridden via the WithReviewStatus() option.

(This does not change the fact that vulnreport create creates
REVIEWED reports by default).

Change-Id: Id4c6d453a2b977986381eb81b7e2fb1087c9b735
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/585516
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-20 16:02:51 +00:00
Tatiana Bradley 43df709521 internal/report: add review_status field to YAML and OSV
Add support for the field "review_status" for both YAML
and OSV, but don't yet publish any reports with the field.

Newly created reports will be marked REVIEWED and newly "unexcluded"
reports will be marked UNREVIEWED by default.

Change-Id: Id04c9d1c9f3240b1fa277c23c2351627c99b1fc4
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/585515
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-20 16:02:37 +00:00
Tatiana Bradley a60d173f1f cmd/vulnreport: add command vulnreport triage
Replace "vulnreport duplicates" with a new command, "vulnreport triage"
that checks the current open issues for duplicates and issues that are likely
not affecting Go code, and determines the issues' priority.

Likely duplicates are labeled "possible duplicate" and issues that may
not affect Go code are labeled "possibly not Go". (This is determined
based on the number of excluded issues labeled "NOT_GO_CODE" that also
affect this module).

An issue is considered high priority if its module has more than 100
importers and has more existing regular reports than excluded reports.

Issues that are high priority are automatically labeled "high priority".

Number of importers is currently determined based on a static file that
is checked into the repo.

Change-Id: Iecb311a68c8c15851417c0f8561df23bcd0e467d
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/584976
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-20 16:02:20 +00:00
Tatiana Bradley 8a00423e35 cmd/vulnreport: refactor vulnreport commands to reuse code
Re-structure the vulnreport commands as collections of composable
types that perform common operations, such as reading GitHub issues
and creating new reports.

This allows us to re-use code & increase the consistency of
the various commands' behavior. It also makes it easier to create new
commands and operate on batches of issues / reports.

Change-Id: I5ffb9c5cf2c9169ca755693d460ee13dc94c18f6
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/584217
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-17 20:42:06 +00:00
Tatiana Bradley 610562879f internal/report, all: use time.Now as default created time
For new reports, the default created time is now time.Now(). An
alternate time (e.g., for testing) can be provided via the WithCreated()
option.

Update tests to include a placeholder created time.

Change-Id: I2c48ac56c89d2f33310fca58ae44ff7e9035f609
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/583837
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-15 21:12:12 +00:00
Tatiana Bradley 2ff2c865e4 all: rename cveschema5 and cveschema to cve5 and cve4
Change-Id: I361574a534adbfdbbe052ed9d6b93b9ff0e01081
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/583657
Commit-Queue: Tatiana Bradley <tatianabradley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-15 14:51:25 +00:00
Tatiana Bradley 57274b497d internal/{ghsa,report}: move ghsaToReport to ghsa package
Change-Id: I8bbb9482dddf3b1c58bcaff037c7d60fcb1539e7
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/583655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-15 14:51:10 +00:00
Tatiana Bradley 685ac1984d all: move cve/ghsa utils to their own package
- Move some functions related to CVE/GHSA regex matching
to a new "idstr" package, as they are not related specifically to the
CVE5 or GHSA GraphQL format.

- Move all logic related to the cve5, cve4 and legacyGHSA formats in
the "internal/report" package to their own files, so it is easier to
(potentially) move these to their own packages in the future.

The goal of this CL is to reduce the risk of import cycles
for some upcoming refactors.

Change-Id: I7e14c31c17882230b783cc62e1ecdf43dcb98995
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/581717
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-15 14:42:37 +00:00
Tatiana Bradley 3b6f478b08 cmd/vulnreport: fix two bugs in "vulnreport duplicates"
- Don't error when an issue is already marked "duplicate"
- Don't mark an issue as a duplicate if it already has a report
(corresponding to the issue itself)

Change-Id: I8909a0963727b070484993fd9e6324ada3c828f5
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/584377
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-15 14:42:27 +00:00
Tatiana Bradley d62c8527c4 all: refactor report.New to take options
Change-Id: I39aa1b2a34d6b6dc65ac1bd30d0336016643c86e
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/583776
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-08 17:44:16 +00:00
Tatiana Bradley 0b083694f3 all: refactor to unify report creation from different sources
Add a new interface, report.Source, which represents a source
(e.g., a GHSA or CVE) that can be converted into a Report.

This is part of an effort to make report creation more uniform
across various sources, and collect together common logic.

Change-Id: If78bab9de143bca72b88ca7f98bd01a51d17ccae
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/579855
Commit-Queue: Tatiana Bradley <tatianabradley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-08 17:04:13 +00:00
Tatiana Bradley d707b2a067 internal/report: add YAML field "source"
Adds a new field, source, which holds metadata about the
original source of the report. For now, it is either a CVE,
a GHSA, or the Go team.

This is not required and is not published to OSV, but will
assist in our automation efforts.

Change-Id: Ief5ea6eca35d8799655b3a86e7a22cf8ff49d4e5
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/576999
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-16 17:23:51 +00:00
Tatiana Bradley b7d35a306b internal/report: fix issue with lint/fix in unexclude
Some operations in "unexclude" were incorrectly operating
on the old report instead of the new report; fix this.

Change-Id: Iaae67a6292bb10e0840e9841cccd0ffe1cc5d4ba
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/576995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-04-16 17:14:08 +00:00
Tatiana Bradley 97afa82fd2 cmd/vulnreport: make commit message generation more clever
In vulnreport commit, automatically change the commit message
is based on the files in the git staging area. For example, if a report
is being updated, use the word "update" to describe the commit. If an
excluded report is being deleted and a corresponding regular report added,
use the word "unexclude".

Change-Id: I021c4f5e8e6b522a9e4ef0597501dfb8426efec2
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/569598
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-03-07 21:06:15 +00:00
Tatiana Bradley 401f8d3efe cmd/vulnreport: use pattern for add/commit in vulnreport commit
Instead of searching for specific derived files to add/commit,
use the pattern "*<Go ID>*" to add/commit all files mentioning the
current Go ID. This will allow commit to work when "unexcluding" a report.

Change-Id: I22f8b91b1fc5f0255db26b9b05d680578817c899
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/569596
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-03-07 21:06:07 +00:00
Tatiana Bradley 2d096105c5 cmd/vulnreport: add flag -user for create-excluded
Adds a flag, -user, which can be used to specify a GitHub username.
When applied to the vulnreport create-excluded command, issues assigned
to other users will be ignored. This can also be applied using the
GITHUB_USER environment variable.

Change-Id: Icc4104823249a393adc5755585fbb3e339ccc945
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/565380
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-03-04 17:42:38 +00:00
Tatiana Bradley 714f3b804a cmd/vulnreport: add command 'vulnreport duplicates'
Command vulnreport duplicates (with no args), finds likely
duplicates for all open issues on the tracker. With args, it finds
likely duplicates for the given issue(s).

This can be used by the vulndb triager to quickly identify duplicate
issues on the tracker.

Change-Id: I863d733a1dbdfcc201457fcf7156698f0012e671
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/567196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-02-28 18:56:53 +00:00
Tatiana Bradley 69f7149441 cmd/vulnreport: remove extraneous newlines from logs
Change-Id: Ia3fe765899d91d51299b9ee03d9d8162a63cf693
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/567197
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-02-28 18:56:40 +00:00
Tatiana Bradley 270b851615 all: remove all code related to legacy vulndb format
This change removes all code related to generating and validating
vulnerability databases in the legacy format.

Fixes golang/go#65320

Change-Id: I83522efec90aa04df54976d5c29d485acd13e53c
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/558658
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-02-21 15:58:05 +00:00
Tatiana Bradley 10c3808cf5 all, internal/report: refactor logic to read reports from vulndb repo
Package the logic to read reports from a vulndb-like repo into
a Client, and update all callers.

For now, the behavior under the hood is basically the same as it was, but
the callers do not need to carry around the specific maps needed
to access certain information.

Change-Id: I7bd28bfbf2a40d5d2bc37453051f866517086f23
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/562177
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-21 15:53:16 +00:00
Maceo Thompson 0c24a58b38 cmd/vulnreport: add -update flag to vulnreport symbols
Adds an -update flag to the vulnreport symbols command.
Previously, vulnreport would automatically add all fix links that
resulted in vulnerable symbols for a given module to that module's
FixLinks field.
Now, if the FixLinks field is populated it is considered the source of
truth, and vulnreport symbols will use only the links in that field.
If FixLinks is empty, vulnreport will derive fix links from the report's
References field and use those to find vulnerable symbols.

Change-Id: Ibab159987b60d445707083885a56ce6dc0e45302
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/562236
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
2024-02-12 19:14:08 +00:00
Tatiana Bradley 3754b2a8ed cmd/vulnreport: various vulnreport changes for batch automation
* When creating or unexcluding a report, add a note to the report that
an error occurred in addition to logging a warning.
* When unexcluding reports, fix and lint the report before writing it.
* In Fix, attempt to add an advisory if the report needs one.

All of these changes are intended to make it easier to batch create &
unexclude reports, and notice when there are issues in the automated
process.

Change-Id: I33ec94a619cf0b89112a682386439a11381b6c57
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/562246
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-09 21:26:46 +00:00
Tatiana Bradley abd35260b9 cmd/vulnreport: add color to logs (and refactor)
Refactor logging and add colors.

Colors are on by default but can be turned off with
`vulnreport -color=false [subcommand]...`, or by setting
the environment variable `NO_COLOR`.

Change-Id: Iaea30dfeb045b2b690683f257cf49676c785951a
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/562555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-02-09 21:26:32 +00:00
Tatiana Bradley 0c44de67e8 internal/report: refactor fix to avoid nil pointer
Split Fix into FixText (which doesn't require a proxy client) and
FixVersions (which does), and only call the FixText portion from
applySuggestion in vulnreport. This avoids a possible nil pointer
dereference.

Change-Id: Ic57cb0738ac64ce892e62c2e16c76efb25c22147
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/562245
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-02-08 15:56:13 +00:00
Tatiana Bradley 48391af368 cmd/vulnreport,internal/symbols: remove logging from internal/symbols
Return errors instead of logging in internal/symbols functions.

Change-Id: I43efd1e27a97a8f6f42abcc361d647fb9eee8f4c
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/562196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Maceo Thompson <maceothompson@google.com>
Commit-Queue: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
2024-02-07 21:40:43 +00:00
Tatiana Bradley ac87c5f510 cmd/vulnreport: add flag to populate symbols in vulnreport create
Add flag "symbols" which causes vulnreport create to attempt to automatically
add symbols to a newly created report.

Change-Id: I0ba9e4fc1365fd05f06915e82d6b33ab9528fbc2
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/560779
Reviewed-by: Maceo Thompson <maceothompson@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-07 18:18:07 +00:00
Tatiana Bradley 60408cbbab internal/symbols, cmd/vulnreport: move logic to add symbols to reports
Move the logic (but don't modify it) to populate symbols to its own file in
internal/symbols. Add some basic tests that confirm the current behavior
(which will likely be tweaked in follow up CLs).

Change-Id: I10593154c343adb680733ebd66a4dd97abed2c43
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/560778
Reviewed-by: Maceo Thompson <maceothompson@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-07 18:17:52 +00:00
Tatiana Bradley 25849289c0 internal/symbols: remove logging from Patched
Bubble up the errors instead of passing a logging function.

Change-Id: Id55c3588170ae822b09ede3ed0e0224089be147b
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/560777
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Maceo Thompson <maceothompson@google.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
2024-02-07 18:17:34 +00:00
Tatiana Bradley ebe3f5047f cmd/vulnreport: add subcommand framework
Adds a new unified framework for vulnreport subcommands. Each subcommand
now implements an interface, command, which has functions for setting up,
running, and tearing down the command.

Change-Id: I7c6ab5cf1b4c19b300dbdef6df0d76e2f1f303ea
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/559955
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-07 18:17:18 +00:00
Tatiana Bradley 7cb175de40 cmd/vulnreport: add command unexclude
Command `vulnreport unexclude` converts an excluded report to a
regular report. Will be used as part of an experiment to add back reports
that were previously excluded from vulndb.

Change-Id: I420a8262144fe6b0f459cb1a8438062931a15700
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/559815
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-02 15:58:17 +00:00
Tatiana Bradley 3d586405b1 cmd/issue: add command issue placeholder
Add a command, `issue placeholder` which can be used to publish a
placeholder issue for a CVE.

Example usage: `issue placeholder CVE-1234-5678 CVE-0000-1111` would
create two issues on the x/vulndb tracker, one for each CVE.

The placeholder issue does not reveal anything about the CVE, and the
command is intended to be used to create tracking issues for CVEs that
have been preannounced but not yet published.

Change-Id: I95ace0eaffe83f77ebc58d4ec755f0276e748c02
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/559601
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-02-02 15:57:58 +00:00
Tatiana Bradley 8127c8770f cmd/vulnreport: move all logging logic to one file
Move all logic for vulnreport logging into a new inner package, log, which
will allow us to more easily change the logging internals (e.g., if we
want to use slog in the future).

Change-Id: I8287fc186451e6dc2e846ed071bd3c6fefdad359
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/559600
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-02 15:57:48 +00:00
Tatiana Bradley 2c6db71774 cmd/vulnreport: fix handling of numSuggestions for Gemini
Unlike the PaLM API, which could generate multiple candidate responses
at once, the Gemini API only gives one response at a time (at least for
now).

To accommodate this, modify suggest to make a separate request to the
API to generate each suggestion.

Change-Id: I5c3adce302abdb5228aef7a8a94d8b3ee5881371
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/559599
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-02-02 15:57:33 +00:00
Tatiana Bradley 079fd4d30d internal/genai, cmd/vulnreport: remove support for legacy PaLM API
The Gemini API has fully replaced the PaLM API so there is no need for
us to maintain support.

Change-Id: I1e6581313b481a7ce9042d5ef82e99cb45ee48cf
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/559598
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-02 15:49:42 +00:00
Tatiana Bradley aff2b00dc5 cmd/vulnreport: add option to use AI in vulnreport create
Add flag "-ai" that causes `vulnreport create` to attempt to auto-populate
an AI-generated draft of a summary and description for a report.

(This functionality can still be accessed post-create via command
`vulnreport suggest`.)

Change-Id: I0a22579b56fa1fb5c302d54afebea96fdcc5504a
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/559597
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-02 15:49:21 +00:00
Tatiana Bradley 1a252d2cea cmd/vulnreport: move main.go code to separate files
The main.go file was becoming somewhat hard to navigate, so this change
moves most of its code to separate files, organized by the subcommand
the code is primarily associated with. This change only moves code and
does not modify its behavior.

Change-Id: I684cda7e2e65eb8a043e8c04fdeda187420a95f0
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/559596
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-02-01 15:57:22 +00:00
Maceo Thompson 6a2e4b6a49 vulnreport: add 'symbols' cmd to vulnreport
This change integrates symbols.Patched into vulnreport.
One can call `vulnreport symbols [REPORTNUMBER]` to use this.
Additionally, if vulnreport is unable to find the correct fix link (this
may happen in cases where there are multiple modules or the report's fix
link is a pull request and not a commit hash), they can populate the
FixLink field per-module.

Change-Id: I6566c67538c4de29547432648a28f50cb735b3ce
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/559156
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-30 20:52:20 +00:00
Tatiana Bradley 0296fe785c internal/database, cmd/gendb: publish the v1 database as a zip file
In the deploy script, additionally publish the Go vulnerability database
as a zip file.

This will allow clients to easily download the database and, for example,
run govulncheck offline.

Once deployed, this new endpoint will be accessible via
https://vuln.go.dev/vulndb.zip

Change-Id: I8e5f3c4e957d3d980e692ac6ad2ca7afefc42086
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/557895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
2024-01-23 18:05:47 +00:00
Tatiana Bradley a720662e13 cmd/vulnreport: allow no CVE/GHSA in issue title
In vulnreport create, allow creation of a basic report if no CVE/GHSA
is provided.

As an unrelated small fix, don't print an empty log message if
there are no xrefs for a created report.

Change-Id: I10df39118f245f1cf898ecf4b8f6bbd4585497be
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/557075
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22 16:05:08 +00:00