-
Notifications
You must be signed in to change notification settings - Fork 142
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
feat: Expose Ubuntu fix status for downstream consumption #407
Changes from 19 commits
d7d0ec2
d37a7d0
b6e2928
04f2549
d27f9cd
b17897b
39d07a0
cc52460
ea1e8b8
7b934dd
afc2b63
be70bd0
d0e32c0
11edc67
a0de802
f6a5b03
d3a544d
ee6fbae
15339ea
9bdfe07
4aafbcc
a488d7f
e4f74bd
20b22f3
a3e59a1
6bc4582
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ const ( | |
) | ||
|
||
var ( | ||
targetStatuses = []string{"needed", "deferred", "released"} | ||
targetStatuses = []string{"ignored", "needed", "pending", "deferred", "released"} | ||
skahn007gl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
UbuntuReleasesMapping = map[string]string{ | ||
"precise": "12.04", | ||
"quantal": "12.10", | ||
|
@@ -170,8 +170,12 @@ func defaultPut(dbc db.Operation, tx *bolt.Tx, advisory interface{}) error { | |
} | ||
|
||
adv := types.Advisory{} | ||
if status.Status == "released" { | ||
normalised_status := StatusFromUbuntuStatus(status.Status) | ||
skahn007gl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if normalised_status == types.StatusFixed { | ||
adv.FixedVersion = status.Note | ||
} else { | ||
// Store the status only if it's unfixed | ||
adv.Status = normalised_status | ||
} | ||
if err := dbc.PutAdvisoryDetail(tx, cve.Candidate, pkgName, []string{platformName}, adv); err != nil { | ||
return xerrors.Errorf("failed to save Ubuntu advisory: %w", err) | ||
|
@@ -213,3 +217,17 @@ func SeverityFromPriority(priority string) types.Severity { | |
return types.SeverityUnknown | ||
} | ||
} | ||
|
||
// StatusFromUbuntuStatus normalises Ubuntu status into common Trivy Types | ||
func StatusFromUbuntuStatus(status string) types.Status { | ||
switch status { | ||
case "ignored": | ||
return types.StatusWillNotFix | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took another read of the document.
It looks like Ubuntu doesn't determine if the package is affected. So, if I understand correctly, we should not show this type of vulnerability. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We consider this an intentional decision that is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Will not fix" means "this package is affected by this flaw on this platform, but there is currently no intention to fix it." It's a Red Hat definition, but we follow it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @knqyf263 Are you happy to proceed with this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @skahn007gl - it seems that treating ignored as wontfix is the issue here, as ignored/EOL findings are typically not ingested to reduce Trivy DB size. I think we can just skip ingesting ignored, we still have the "notaffected" status to determine if the outcome of analysis is that Ubuntu decided not to fix it. For EOL stuff, we can work that out another way on our end, and treat findings for EOL releases as wontfix if they don't have another status. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trivy is designed to minimize false positives as much as possible. EOL means unknown and is possibly a false positive, which is why we currently do not detect it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While i see the reasoning behind this and do not disagree, I am happy to follow guidance and remove the status for ubuntu. @knqyf263 let me know if you feel strongly on removing I would like to highlight the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We believe "ignored" in Debian differs from "ignored" in Ubuntu. They use the same term by chance. Please let us know if you find a document in which Debian also uses "ignored" for EOL. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @knqyf263, @jhebden-gl |
||
case "needed", "pending", "deferred": | ||
return types.StatusFixDeferred | ||
case "released": | ||
return types.StatusFixed | ||
default: | ||
return types.StatusUnknown | ||
} | ||
} |
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 key must be a package name. Isn't
trusty
a codename?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.
Ah yes it should be. I read
xen
asxenial
, Will change the test data and get it pushedThere 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.
test data updated and pushed.