Replace per-source enable booleans with SourcePrecheck and bump SDK to v1.9.0
Sources that always work (botvrij, disconnect, oisd, openphish, phishtank, quad9) drop their user-facing enable_* option; the rule's enabled/disabled state is now solely controlled by the SDK rule toggle. Sources that require credentials (criminalip, malwarebazaar, otx, pulsedive, safebrowsing, threatfox, urlhaus, virustotal) instead implement the new SourcePrecheck interface so the host UI can surface "not configured" before attempting a query.
This commit is contained in:
parent
ce59a976d5
commit
c3cda1f104
25 changed files with 189 additions and 175 deletions
|
|
@ -57,6 +57,17 @@ type Source interface {
|
|||
Evaluate(r SourceResult) (listed bool, severity string)
|
||||
}
|
||||
|
||||
// SourcePrecheck is an optional interface a Source can implement to
|
||||
// declare whether the current options are sufficient for it to run.
|
||||
// Used to surface "rule unavailable because the operator hasn't
|
||||
// configured the credentials yet" in the host UI via the SDK's
|
||||
// RulePrecheck contract. Returning nil means "ready to run"; any error
|
||||
// is shown verbatim to the operator.
|
||||
type SourcePrecheck interface {
|
||||
Source
|
||||
Precheck(ctx context.Context, opts sdk.CheckerOptions) error
|
||||
}
|
||||
|
||||
// DetailRenderer is an optional interface a Source can implement when
|
||||
// the generic SourceResult shape (Reasons + Evidence + URLs) cannot
|
||||
// fully express its output. Examples: VirusTotal's per-vendor verdict
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue