-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/report: add new status NEEDS_REVIEW
Add a new YAML report status, NEEDS_REVIEW, which indicates that a report has been automatically generated but needs to be reviewed by a human later. The goal of this new status is to allow us to quickly publish initial versions of *most* reports that will require review. A report with status NEEDS_REVIEW has slightly stricter requirements than UNREVIEWED reports: - NEEDS_REVIEW reports must have a fixed version for each affected module - NEEDS_REVIEW reports must not have any "unsupported_versions" These stricter requirements prevent us from publishing low-information reports that could affect many users. Auto-generated reports that do not meet these requirements need to be manually reviewed by a human. When a new NEEDS_REVIEW report is committed, the automatically generated commit message includes "Updates #NNN" for the corresponding issue instead of "Fixes #NNN", because additional action is still needed. NEEDS_REVIEW is an internal status only - it is converted to UNREVIEWED when published to OSV. Change-Id: I340279f5a3f73e508b145f613d3d07d71e870aaa Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/626157 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Damien Neil <[email protected]>
- Loading branch information
Showing
19 changed files
with
399 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2023 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package osvutils | ||
|
||
import ( | ||
"golang.org/x/vulndb/internal/osv" | ||
"golang.org/x/vulndb/internal/version" | ||
) | ||
|
||
func LatestFixed(ranges []osv.Range) string { | ||
var latestFixed string | ||
for _, r := range ranges { | ||
if r.Type == osv.RangeTypeSemver { | ||
for _, e := range r.Events { | ||
if fixed := e.Fixed; fixed != "" && version.Before(latestFixed, fixed) { | ||
latestFixed = fixed | ||
} | ||
} | ||
// If the vulnerability was re-introduced after the latest fix | ||
// we found, there is no latest fix for this range. | ||
for _, e := range r.Events { | ||
if introduced := e.Introduced; introduced != "" && introduced != "0" && version.Before(latestFixed, introduced) { | ||
latestFixed = "" | ||
break | ||
} | ||
} | ||
} | ||
} | ||
return string(latestFixed) | ||
} |
Oops, something went wrong.