Repository navigation
Conversation
- Add RapidFort-specific matcher that identifies containers via image labels and routes vulnerability lookups through the RapidFort DB - Refactor matcher selection into the matcher package - Add Red Hat advisory support: parse OS FixedIn identifiers and emit release-identifier refs with vendor advisory URLs in v6 transform - Fix binary lookup match type (ExactDirectMatch) and expand test coverage for label detection and distro version parsing Signed-off-by: Vaibhav Thatai <vaibhav@rapidfort.com>
Signed-off-by: Vaibhav Thatai <vaibhav@rapidfort.com>
Signed-off-by: Janit Lodha <janit.lodha@rapidfort.com>
Signed-off-by: Janit Lodha <janit.lodha@rapidfort.com>
Signed-off-by: Janit Lodha <janit.lodha@rapidfort.com>
… and document its semantics Signed-off-by: Janit Lodha <janit.lodha@rapidfort.com>
Signed-off-by: Janit Lodha <janit.lodha@rapidfort.com>
…alignment Signed-off-by: Janit Lodha <janit.lodha@rapidfort.com>
…r clarity Signed-off-by: Janit Lodha <janit.lodha@rapidfort.com>
…fallback rule Signed-off-by: Janit Lodha <janit.lodha@rapidfort.com>
…atcher-selection accessor Signed-off-by: Janit Lodha <janit.lodha@rapidfort.com>
Updating Rapidfort Images Detection Mechanism
…d Ubuntu variant additions Signed-off-by: Janit Lodha <janit.lodha@rapidfort.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com> # Conflicts: # grype/db/v6/build/transformers/os/transform_test.go
Signed-off-by: Keith Zantow <kzantow@gmail.com>
11a26a5 to
5cdd53a
Compare
Signed-off-by: Keith Zantow <kzantow@gmail.com>
…apidfort Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
| log.WithFields("error", err).Warn("unable to load search rules from DB; falling back to built-in defaults") | ||
| rows = nil | ||
| } | ||
| if rows == nil { |
There was a problem hiding this comment.
This is subtle that it's explicitly nil, vs just len(rows) == 0. Do we know whether at https://github.com/anchore/grype/pull/3751/changes#diff-20f991f6ce703181473acf0176595a408530d7b0678faa25905642a248557e71R28 gorm will init the row slice? I think maybe it will: https://github.com/go-gorm/gorm/blob/v1.31.2/scan.go#L295-L303
There was a problem hiding this comment.
it is explicitly set to nil if there is an error to fall back; added a comment so this is more clear
There was a problem hiding this comment.
What is the intended behavior if the table is present but the query works, but the table is empty?
There was a problem hiding this comment.
if the table is present but empty, it's intended to mean no search rules -- the hardcoded ones could be wrong. I don't know that's the right behavior, but that's the reason for the current implementation
There was a problem hiding this comment.
I think migrating the db will create the empty table? So if a new client imports an old DB, the table gets created as empty instead of with defaults. If the table is present at DB build time but empty, it will correctly get zero rows, but I'm not sure it's correct for a table that's absent at DB build time (because grype-db is behind, for example) to get zero rows.
Signed-off-by: Keith Zantow <kzantow@gmail.com>
… labels Signed-off-by: Keith Zantow <kzantow@gmail.com>
This PR adds DB-driven search rules to allow queries to include additional data sets based on per-package matched values (e.g. version containing
.rf#,echo#,ubuntu#), results are assigned priority to assess vuln applicability across multiple conflicting results, and the PR uses these changes to support RapidFort curated-image advisories.Search rules
SearchRulemodel and store (DB schema 6.1.10). Each Match*/Exclude* predicate (distro name/version, ecosystem, package name/version, etc.) is an exact value or a regex. Every rule needs at least one indexed literal predicate (e.g. at least package typedeb) to limit the impact to matching performancesearch.RuleCriteria); multiple rules can match a single query to include the original query or different, lower priority data setsMatch behavior with conflicting evidence
An increasing problem we haven't properly handled is a single package having multiple applicable records describing the same vulnerability: an APK package might have NVD, Alpine, and a derivative distro back-porting fixes at a faster cadence, where Alpine and the distro only report fixes rather than disclose vulnerabilities. Deciding across these disparate data sources is increasingly important in the current landscape and this PR attempts to solve this with a few exceptions noted below. The general approach which also accounts for search rule matched records is:
result.Rank: when results for one vulnerability disagree, a result from a rule's search beats the package's own result. After that, the higher rule priority wins, then the stronger match typeSplitVulnerablesorts records into vulnerable and not vulnerable based on heuristics and rankings:RapidFort
rapidfort-*distros (alpine, ubuntu, redhat, including Ubuntu variants) and a DB transformer for RapidFort vuln datadistro-identifiers.rapidfort.apply:auto|never(defaultauto)Misc. output fixes
Notes
grype-dband upgrade quality gate to a db built with qualifiers properly in unaffected records