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

350 Коммитов

Автор SHA1 Сообщение Дата
Tatiana Bradley 346af9bdbc cmd/worker: bump Go version in Dockerfile
Change-Id: I4a455713d6a0201c8d76e537ca939d3b389b25d5
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/612216
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-09-13 21:20:19 +00:00
Tatiana Bradley e7ba7f0d47 cmd/cve: fatal error on publish-all failure
Change-Id: Ieba5bb635c65675868c74c4a2364e9cabd16de6a
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/611377
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-09-06 20:51:41 +00:00
Tatiana Bradley 73190ac6a7 internal/report: add new excluded reason WITHDRAWN
Add new excluded reason, WITHDRAWN, which indicates
that a report was withdrawn before we got a chance
to publish it in vulndb.

This allows us to keep better track of withdrawn reports
(as opposed to completely omitting them from our
records).

Change-Id: I7209edc88e903787b0c79556177af8f34fed8a4e
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/607818
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-08-26 20:06:40 +00:00
Tatiana Bradley 9c55f263e3 internal/report: use variables to represent excluded reasons
Change-Id: Ic83a96592f865d4643a760a6bc10718cf5c075a0
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/607817
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-26 20:06:37 +00:00
Tatiana Bradley b75d871dca cmd/cve,deploy: publish CVEs automatically
The post-submit trigger that deploys vulndb now
additionally publishes or updates any CVEs that
have changed via the CVE Services API.

This means we no longer need to manually publish
CVEs in the normal course of business.

This is safe because the CVE program no longer
makes direct edits to CVE records, so the records
in data/cve/v5 are canonical.

This CL additionally removes the logic to handle
the case in which a record was modified by the CVE
program, and adds a convenience command "publish-all"
which non-interactively publishes/updates all
CVEs that need it.

API user name and token for the service account
are stored in GCP Secret Manager.

Manual tests via "gcloud builds submit" worked.

Change-Id: I68ce77001067c6e1eff9478234ec7fc76dac587d
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/606779
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-19 21:20:54 +00:00
Tatiana Bradley 9c256df087 internal/genericosv: avoid github rate limits in batch commands
Use the authenticated github client instead of a direct HTTP request
to the Github API when fetching the published time for a GHSA.

This allows us to perform batch commands without being rate-limited.

Change-Id: Ie4f357ab9ec105389f6990964a86f27b77079271
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/606357
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-19 17:24:33 +00:00
Tatiana Bradley 8a13ef9b72 cmd/vulnreport: consider withdrawn status in vulnreport create commands
When converting from GHSA OSV to YAML, preserve the withdrawn status,
and consider it in the "create-like" commands of vulnreport:

 - for create, create-excluded, and unexclude, error if a report is
   withdrawn (there is no need to publish a new withdrawn report)
 - for regen, allow a withdrawn report (this allows us to withdraw
   published UNREVIEWED reports that were later withdrawn by the source)

Change-Id: Ifafd543c7620418280d6312cb7fedf558e46d04f
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/606356
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-08-19 17:24:31 +00:00
Tatiana Bradley 0efc140091 cmd/vulnreport: simplify the duplicates process
Remove the "possible duplicate" label and instead
label all suspected duplicates as "duplicate" and
post a comment of the form "Duplicate of #NNN" to
the issue.

Update the instructions for the triager.

This is OK because the duplicate-finding check is
almost always correct.

Change-Id: I9d036f3a0490564000a13d783353608cde39880a
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/606236
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-08-16 17:42:07 +00:00
Tatiana Bradley 77742ae20d internal/{report,ghsarepo}: add functions NewLocalClient
Change-Id: I52c09d039181a7be2808ce742283b1dd7d342371
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/601388
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-30 15:44:29 +00:00
Tatiana Bradley 9da573a4ce cmd/triage: add command triage
Add a command, whose usage is "triage CVE-XXXX-YYYY"
(or "triage GHSA-xxxx-yyyy-zzzz", but that is trivial as GHSA's
specify their ecosystem explicitly) that gives direct
access to the worker triage algorithm.

This helps with experimentation and testing of tweaks to
the algorithm. (The goal is to make this much faster
by greatly reducing the number of requests made to pkgsite).

Change-Id: I74d54e60afbb1fe7ebf26fce4ae2d079ecb63b4b
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/601379
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-30 15:44:07 +00:00
Tatiana Bradley 2b185852c9 all: move triage-related code to its own package
Separate triage-related code to its own internal
package so it can be re-used throughout.

Change-Id: I1c143624d718b896edb64afa020875925210b094
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/601378
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-07-30 15:43:52 +00:00
Tatiana Bradley 3c3dfc5885 all: fix lints
Fix small issues like unused symbols, unchecked errors etc.

Bump dependency on protobuf, which has a vulnerability.

Change-Id: I10385ff41302d1446c35af43ae72219fc9687150
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/601376
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-29 18:12:34 +00:00
Ian Cottrell 73d67655cc cmd/vulnreport: Add the error message to the unable to label warning.
Change-Id: If6db5166175b63cee4516e0fd357a53dd6a823e6
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/600835
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-24 18:55:07 +00:00
Tatiana Bradley 7010d1a9c9 internal/report: fix issue tracker link in xrefs
Change-Id: I7ef557c071316b5faa4a696667db98e91e69991e
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/600237
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-22 22:56:43 +00:00
Tatiana Bradley 6a3e5044b4 cmd/vulnreport: fix bug in duplicate-finding for triage
Fix a bug in which the "likely duplicate" label was applied
to all issues that have duplicates on the tracker. (For example,
if #1 and #2 both refer to GHSA-xxxx-yyyy-zzzz, only one of
these should be marked as a duplicate).

This also revealed some bugs in the fake in-memory implementation
of the GHSA API, which are now fixed.

Change-Id: Ifd98befdf3e23f1fc95df38533107de9c921b195
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/599456
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-22 18:24:17 +00:00
Tatiana Bradley ebcb244a81 cmd/vulnreport: check if packages exist in vulnreport fix
Add a simple check for package existence in vulnreport fix, which
pings pkg.go.dev to determine if a package exists.

This is more likely to succeed (and faster) than the package/symbol
check which downloads the whole package. We now skip this symbol-check
when there are no symbols listed.

There are still some cases in which this fails incorrectly (e.g. if pkgsite
for some reason couldn't cache the given package/version), so the check
can be bypassed.

Change-Id: I922eae0dec9a376210f0f0fd1d70a67da934ffaa
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/599180
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-19 16:06:05 +00:00
Tatiana Bradley 0550a0e977 cmd/vulnreport: only write files if they would be modified
Before writing YAML/OSV/CVE files, check if their contents would
be modified. The main benefit of this is that we now only print
out the written filename if its contents change, which is helpful
for determining the impact of batch operations.

Change-Id: Ieae133a1697d98b99cb40dda56826a5c46f40487
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/599179
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-07-19 16:05:29 +00:00
Tatiana Bradley 76c7a5b6fd internal/{report,worker}: update display of xrefs
Unify the display of xrefs in the worker and in vulnreport xref.

Call out duplicate aliases more prominently, as they indicate a problem,
whereas module xrefs are informational.

Change-Id: I3898ab1709bb3bfd6aefcfa4aef236af5f270fa7
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/599176
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-07-19 16:04:37 +00:00
Tatiana Bradley 2ae4aed38a cmd/vulnreport: embed test files
Change-Id: I2828b15f925e6d4d66c799517c80150936b37838
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/599175
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-19 16:04:25 +00:00
Tatiana Bradley bca6ae2d15 cmd/vulnreport: double-check priority after create and in presubmit
The algorithm that determines priority for a report
relies on the affected modules. Sometimes not all affected
modules are known at the outset (e.g., because they are
fixed during report creation).

Ensure that we don't accidentally create UNREVIEWED reports
which are high priority by re-checking the priority of a report
after creating it. As an extra safeguard, also do this check in
the TestLintReports function which acts as a presubmit check.

This involves some refactoring of the priority algorithm. The only
change to the fundamental behavior is that an override list
now exists, where we can add modules that should always have a
certain priority regardless of what the priority algorithm would
say.

Also, the xref command now addionally prints out the priority decision
for a report.

Change-Id: Ia3301022678d7392fb3deb059f9a248dcb153ecc
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/598415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-07-19 11:16:18 +00:00
Tatiana Bradley 825527a13e cmd/vulnreport: add command vulnreport withdraw
Adds a command that makes it easier to withdraw an
existing report.

Usage:

$ vulnreport -reason="..." withdraw NNN

Change-Id: Iabe6c1a4b0d0ce15692bb6be743876a790dec437
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/595996
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-07-15 17:56:36 +00:00
Tatiana Bradley ce4433b318 cmd/vulnreport: remove option to pull GHSAs from the GraphQL api
This was a backup option in case osv.dev did not have the GHSA yet;
this is no longer needed now that we're pulling directly from Github.

Change-Id: Ib5a1b9752eac1efe2a91ef0403771d5575180402
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/597755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-07-15 17:56:30 +00:00
Tatiana Bradley 4789343033 internal/genericosv: fetch GHSAs from github instead of osv.dev
Fetch GHSA OSV from github.com/github/advisory-database instead
of osv.dev, as osv.dev sometimes makes edits to the OSV or has
an older version of it.

Unfortunately this requires making two HTTP requests: the first to
determine the published year/month of the GHSA from api.github.com,
and the second to pull the OSV from the GHSA database git repo. There
is no way (that I am aware of) to make a direct API call to get GHSAs
in OSV format.

Change-Id: I8bfd580b1e8ee38f9bc6b8afb08415e0de1a3040
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/597735
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-15 17:56:17 +00:00
Tatiana Bradley 61369c8fa8 cmd/inspect: add data on withdrawn and (un)reviewed reports
In the inspect command, display stats on the number of
withdrawn and unreviewed reports in the corpus.

Change-Id: I724a4f2bc00dbe279c2b20ecd9da5fcd961c029c
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/596181
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-15 16:53:26 +00:00
Tatiana Bradley 7c2244f7ea cmd/vulnreport: auto-populate cve_metadata for first-party reports
For first-party reports where we have assigned our own CVE,
auto-populate "cve_metadata" instead of "cves".

Change-Id: Ifa23ece087f03a294e07ba4fba4267a0de890431
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/596179
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-07-09 19:34:30 +00:00
Tatiana Bradley 6155dc5273 cmd/vulnreport: skip issues marked NeedsAlias in create
Change-Id: Ie21d520396277e1b36a0a10224c5f73aaafcb50f
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/597157
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-07-09 19:34:15 +00:00
Tatiana Bradley f272f63ad0 all: publish non_go_versions as custom_ranges in OSV
Change-Id: I737910df80c37a6027b08916abe3b3f413795bbe
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/597155
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-07-09 19:33:56 +00:00
Tatiana Bradley 4ad8671bd5 cmd/vulnreport: further unify code of vulnreport regen and review
Change-Id: I1da43b41d7972860760121211de6f47abf0a2c30
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/595635
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-28 15:28:22 +00:00
Tatiana Bradley f8ec56095d internal/report: move some functionality from vulnreport to report.New
Move removal of description and packages (for UNREVIEWED reports)
to report.New so that these actions can be tested more easily.

Change-Id: Ie533f3ef5642f0866c91c28010482eec1d844739
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/595275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-28 15:28:10 +00:00
Tatiana Bradley d10c878bff internal/proxy: use latest instead of list to test existence
Change-Id: I144dc8b0a9b32620172b48a92da5443ac65911b4
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/594898
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-28 15:27:33 +00:00
Tatiana Bradley c65b9da434 cmd/vulnreport: preserve unexcluded reason in vulnreport regen
Change-Id: Id3ba7aa4b4183658023dd198879ada0f0be3e49b
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/594900
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
2024-06-26 22:50:24 +00:00
Tatiana Bradley b2598231f8 all: update YAML versions to closely match OSV versions
Instead of storing version ranges as structs with paired
Introduced/Fixed versions, follow the OSV convention of
considering each version as its own object with an associated
type.

This simplifies operations such as sorting and merging version
lists, making it easier for us to improve automation.

The only effect on the user (vulndb maintainer) is that the
YAML syntax is now:

    - introduced: xxx
    - fixed: xxx

instead of

    - introduced: xxx
      fixed: xxx

As a convenience, however, the old format is still accepted for
writing reports. (However, it will be automatically converted to the
new format when vulnreport fix is run).

A follow up CL will make this change for all existing YAML reports.
This will NOT affect the published OSV files.

Change-Id: I91c524b311be5230db5d382f77de4a8e0cd1dda7
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/593820
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-26 14:53:24 +00:00
Tatiana Bradley 7e022159cc cmd/vulnreport: don't run fix twice for unreviewed reports
Change-Id: Iad59d70e0b7302db4e1d444a488936d5a564a1a1
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/593818
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-26 14:52:33 +00:00
Tatiana Bradley 50d94f1316 internal/genericosv: work around bug in Severity unmarshal
There is an unknown bug causing unmarshal for OSV Severity field
to not work.

We don't use this field, so to work around this issue for now,
simply ignore the Severity field.

To do this, the dependency on osv-scanner was removed and the
relevant files were copied and modified as needed.

Change-Id: I956ea5d2c9c19f2992e6a1c9b723cea35f5e92d6
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/593817
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-25 22:45:44 +00:00
Tatiana Bradley 4ec3107262 internal/report: add field unexcluded to YAML
Record the reason a report was previously excluded when
unexcluding it. This will allow us to take this info into account
when deciding the priority of new reports.

Change-Id: I6ad08f28ca7f9bec78280f30db35b0b6546085db
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/592776
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-20 18:18:17 +00:00
Tatiana Bradley 35a8b0bd5d cmd/vulnreport: add two convenience flags
1) For commit, allow the user to specify a batch size with -batch=X
2) For fix, allow the user to skip all non-lint checks with -skip-checks

Change-Id: I1a42e793cecae6f3086c613e63f410e664f4cce8
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/592758
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-20 18:17:52 +00:00
Tatiana Bradley 906b621fbf cmd/vulnreport/priority: take unexcluded reports into account
When using the existing corpus to prioritize new vulnerabilities,
treat unreviewed unexcluded reports the same as likely-binary excluded
reports.

Change-Id: Id803d05ecd33b4486086acac8ff124977b3725ef
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/592777
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-20 18:17:33 +00:00
Tatiana Bradley 55acf55625 cmd/vulreport: fix duplicate finding in vulnreport triage
Previously, vulnreport triage only considered a subset of open
issues (namely, the ones being processed by the command) when
looking for duplicates. This meant that the command only worked
properly when operating on all open issues.

The command now considers all open issues when looking for duplicates.

Change-Id: Iefe17a46503e50bccdd7dc43561999aa1fae4db0
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/592757
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-20 18:17:18 +00:00
Tatiana Bradley c87828f329 cmd/vulnreport: add command vulnreport review
Command vulnreport review converts an unreviewed report
to a reviewed one, regenerating the report from the latest
version of the source and leaving TODOs as appropriate.

Change-Id: Ifc2bf85b00e5495852af6bd5086b6dc402cbebb2
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/592775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-20 18:17:06 +00:00
Tatiana Bradley 1514991de8 cmd/cve: add command cve reject
Adds a command that allows the user (authenticated as a CNA) to
"reject" a CVE that will never be published.

This is intended for CVEs that were reserved but will never be assigned
to a vulnerability because, e.g, the year is not current.

Change-Id: Id60a0e5417d43e791ada898ff83bcef2563c2322
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/592435
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-06-17 20:07:56 +00:00
Tatiana Bradley f6caf5ced6 cmd/vulnreport: fix nil pointer deref in vulnreport regen
Change-Id: I734d49b73f1924c2aea7c126b253d3d328dd09ee
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/592756
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
2024-06-17 20:07:17 +00:00
Tatiana Bradley 12d366acf9 cmd/vulnreport: skip issues that are out of scope
Issues labeled OUT_OF_SCOPE should not get a report at all,
so skip them in "vulnreport create".

Change-Id: Ic7051c1ca96e1836653f4f5fc5633a771ccec805
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/592455
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-14 13:40:59 +00:00
Tatiana Bradley a5e41834b9 cmd/vulnreport: add test framework for vulnreport
Adds a test framework that allows tests to inject fake/mock
dependencies into the vulnreport commands and record the expected
output of commands.

Some subcommand tests are left as TODOs, as they require additional
fake/mock dependencies that haven't been implemented yet.

Change-Id: I25f6085f2297e5b9d916f0927c1111ac2b49bef8
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/590038
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-13 15:59:21 +00:00
Tatiana Bradley a2650ed283 internal/worker: unify some firestore functions
Where possible, unify Firestore operations so that there
are not separate functions for adding/updating/fetching
a record based on its type (CVE/GHSA). The intended operation
is inferred by given ID(s).

Change-Id: Ic82e3ab4c9d519c3101f95444bc0ad306fa2a14e
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/588759
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-13 13:52:38 +00:00
Tatiana Bradley 1283e469ae internal/worker: rename CVERecord and GHSARecord
Rename CVERecord->CVE4Record and GHSARecord->LegacyGHSARecord.

Both of these need to be updated to support CVE JSON 5 and
GHSA OSV record formats, respectively, so this change makes
it more clear where the old formats are being relied on.

Change-Id: Ib339f0addbc16c37ed03383d64e7cdb30165f366
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/588758
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-13 13:52:24 +00:00
Tatiana Bradley 09e5a2e740 internal/worker: unify issue template for CVEs and GHSAs
Refactor worker code so that the body of issues created from
CVEs and GHSAs have the same basic structure.

Change-Id: Icf082de5642fbb2c13bbb0478916afed52548585
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/586139
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-13 13:52:07 +00:00
Tatiana Bradley afddd60f5a cmd/vulnreport: remove packages and bad URLs for unreviewed reports
When creating unreviewed reports, automatically remove references
that do not exist.

Also remove package-level data, as it can cause false-negatives
if it is not correct.

(For reviewed reports, we preserve these pieces of info as a human
will review them and manually determine if they are useful).

Change-Id: I2ff6bde62320d2f56f9d5a67ef438f4cafbaf6e5
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/591200
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-06-10 16:38:45 +00:00
Tatiana Bradley eec3f2aed8 cmd/vulnreport: update and separate module prioritization code
Modify the prioritization algorithm so that it only considers the number
of reviewed vs. likely-binary reports, instead of comparing the number
of excluded vs. non-excluded reports. This means that the number of unreviewed
reports does not (currently) affect the prioritization result.

In addition, separate the code used to prioritize modules (for vulnreport triage)
into its own package so it can be tested in isolation.

Also add a basic command line tool "priority" that can be used to find the
priority result for a module directly.

Change-Id: Ic7ebe76d8f5091f56bc3eb65a5064391136b2064
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/591195
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-06-10 16:37:53 +00:00
Tatiana Bradley f159766da6 cmd/vulnreport: add command vulnreport regen
Command vulnreport regen regenerates a report based on
the latest version of the source.

Intended for UNREVIEWED reports.

Use the following command to regenerate all unreviewed
reports:
$ vulnreport regen data/reports/*.yaml

Change-Id: I3f956fde473b8375bd523049118d8f6817aad9ae
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/590856
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-10 16:19:29 +00:00
Tatiana Bradley c016f634dd cmd/vulnreport: fix two issues with triage
1. Don't remove existing labels when triaging
2. Skip issues already marked excluded when triaging

Change-Id: I5e3fd3a614f56407d75c920202937b4534fe15c9
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/590776
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
2024-06-05 17:18:38 +00:00