-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rhel: move IgnoreUnpatched config key from updater to matcher
Previously the IgnoreUnpatched config key was a part of the RHEL updater and would dictate whether or not the updater would ingest unpatched vulnerabilities. This change moves that key to the RHEL matcher and dictates whether the matcher should check for a fixed_in_version when querying potential vulnerabilities. This makes the config option more usable at the expense of DB size. Signed-off-by: crozzy <[email protected]>
- Loading branch information
Showing
8 changed files
with
83 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package rhel | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
|
||
"github.com/quay/zlog" | ||
|
||
"github.com/quay/claircore/libvuln/driver" | ||
) | ||
|
||
var ( | ||
_ driver.MatcherFactory = (*MatcherFactory)(nil) | ||
_ driver.MatcherConfigurable = (*MatcherFactory)(nil) | ||
) | ||
|
||
type MatcherFactory struct { | ||
ignoreUnpatched bool | ||
} | ||
|
||
// MatcherFactory implements [driver.MatcherFactory] | ||
func (f *MatcherFactory) Matcher(ctx context.Context) ([]driver.Matcher, error) { | ||
m := &Matcher{ | ||
ignoreUnpatched: f.ignoreUnpatched, | ||
} | ||
return []driver.Matcher{m}, nil | ||
} | ||
|
||
type MatcherFactoryConfig struct { | ||
IgnoreUnpatched bool `json:"ignore_unpatched" yaml:"ignore_unpatched"` | ||
} | ||
|
||
// MatcherFactory implements driver.MatcherConfigurable. | ||
func (f *MatcherFactory) Configure(ctx context.Context, cfg driver.MatcherConfigUnmarshaler, _ *http.Client) error { | ||
var fc MatcherFactoryConfig | ||
if err := cfg(&fc); err != nil { | ||
return err | ||
} | ||
f.ignoreUnpatched = fc.IgnoreUnpatched | ||
zlog.Info(ctx). | ||
Str("component", "rhel/MatcherFactory.Configure"). | ||
Bool("ignore_unpatched", f.ignoreUnpatched). | ||
Msg("configured") | ||
return nil | ||
} |
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