-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EPSS enricher #1439
base: main
Are you sure you want to change the base?
EPSS enricher #1439
Conversation
e876194
to
32941b1
Compare
|
||
const ( | ||
// Type is the type of data returned from the Enricher's Enrich method. | ||
Type = `message/vnd.clair.map.vulnerability; enricher=clair.epss schema=https://csrc.nist.gov/schema/nvd/feed/1.1/cvss-v3.x.json` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
converting CSV file to json, not sure what the Type
should look like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we need to point to an actual schema here
f5058ef
to
7fbe5d3
Compare
34f4e08
to
5f69717
Compare
183e018
to
1f7633c
Compare
As of Nov 20th, we decide to include model version and score date in the enrichment data |
5712f01
to
843f8f6
Compare
ctx = zlog.ContextWithValues(ctx, "component", "enricher/epss/Enricher/Configure") | ||
var cfg Config | ||
e.c = c | ||
if f == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will leave this to @crozzy but I see there is no precedence for nil
checking, and in the current usage, any nil
function is replaced with a noop
one
return Type, []json.RawMessage{b}, nil | ||
} | ||
|
||
func newItemFeed(record []string, headers []string, modelVersion string, scoreDate string) (driver.EnrichmentRecord, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will review this once the other comments are resolved
9525df0
to
6bdb39d
Compare
// | ||
// It allows for "CVE" to be case insensitive and for dashes and underscores | ||
// between the different segments. | ||
var cveRegexp = regexp.MustCompile(`(?i:cve)[-_][0-9]{4}[-_][0-9]{4,}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a copy, we should find a place (probably within the enrichment package) where this will live.
"github.com/quay/claircore" | ||
"github.com/quay/claircore/libvuln/driver" | ||
"github.com/quay/claircore/pkg/tmp" | ||
"github.com/quay/zlog" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs to be updated to format @RTann described
|
||
const ( | ||
// Type is the type of data returned from the Enricher's Enrich method. | ||
Type = `message/vnd.clair.map.vulnerability; enricher=clair.epss schema=https://csrc.nist.gov/schema/nvd/feed/1.1/cvss-v3.x.json` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we need to point to an actual schema here
enricher/epss/epss.go
Outdated
func (e *Enricher) FetchEnrichment(ctx context.Context, _ driver.Fingerprint) (io.ReadCloser, driver.Fingerprint, error) { | ||
ctx = zlog.ContextWithValues(ctx, "component", "enricher/epss/Enricher/FetchEnrichment") | ||
newUUID := uuid.New() | ||
hint := driver.Fingerprint(newUUID.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updaters are going to run multiple times per day so wouldn't the data be the same in subsequent requests a lot of the time? If yes, we should use the etag/fingerprint to determine if anything has changed, and if not, don't bother processing again.
enricher/epss/epss.go
Outdated
item := make(map[string]interface{}) // Use interface{} to allow mixed types | ||
for i, value := range record { | ||
// epss details are numeric values | ||
if f, err := strconv.ParseFloat(value, 64); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there certain known values that will not parse into floats that we'd still want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think originally value
here was string type
Signed-off-by: daynewlee <[email protected]>
Signed-off-by: daynewlee <[email protected]>
Signed-off-by: daynewlee <[email protected]>
4709a48
to
411d044
Compare
Signed-off-by: daynewlee <[email protected]>
5daafdc
to
0383991
Compare
Epss enricher should be able to update, parse EPSS data and enrich vulnerability report with the data