Documentation
¶
Overview ¶
Package feed loads the runtime sensor's rules from an organisation's published detection rule feed (vdb-site detection_rule_feeds_sensor.go).
A feed is a manifest.json listing each file with its SHA-256, the files, and manifest.json.sig, an Ed25519 signature over the manifest bytes. The sensor reads rules.json, which names each rule, its start mode and its body.
Verification decides what the sensor may do with a rule, not whether it loads: a feed whose signature checks out against the pinned key yields verified rules, which may block; anything else yields unverified rules, which the verdict engine only ever reports. A file whose hash does not match the manifest is refused outright, signed or not, because it is not the file the manifest describes.
Index ¶
Constants ¶
const RuleTypeIOCList = "IOC_LIST"
RuleTypeIOCList is the rule type of an indicator list the site serves.
const UnverifiedIndicators = "served by the site; indicator lists report and never block"
UnverifiedIndicators is why an indicator list is never verified.
Variables ¶
var ErrNotModified = errors.New("feed not modified")
ErrNotModified is returned when the manifest has not changed since the last successful fetch.
var ErrRevoked = errors.New("the sensor's credential was revoked")
ErrRevoked is returned when the site refused the sensor's credential as revoked (401 with {"revoked":true}).
Functions ¶
func IndicatorRuleUUID ¶
IndicatorRuleUUID is the rule uuid an indicator list loads under, stable for the reference so the console keeps one row per feed.
func IsIndicatorRef ¶
IsIndicatorRef is whether ref names an indicator list the site serves: catalog:<id> or org:<uuid>.
Types ¶
type Fetcher ¶
type Fetcher interface {
// Fetch returns the rules, or ErrNotModified when nothing changed since
// the last successful fetch.
Fetch(ctx context.Context) (Loaded, error)
// Ref is the reference the source was configured with: for logs, and the
// key the agent keeps its last good result under.
Ref() string
}
Fetcher is anything the sensor loads rules from: a signed Vulnetix rule feed (Source) or an indicator list the site serves (Indicators).
type Indicators ¶
type Indicators struct {
// Reference is catalog:<id> or org:<uuid>.
Reference string
// Endpoint is the site API the uplink talks to.
Endpoint string
// Authorization is the sensor's Authorization header, the uplink's.
Authorization func() string
// Stopped, when set and true, skips the fetch: the uplink was stopped by
// a revoked credential, and the last list keeps running.
Stopped func() bool
HTTP *http.Client
UserAgent string
// contains filtered or unexported fields
}
Indicators is an indicator list the site serves for a catalog: or org: reference (GET /v1/runtime/feeds/{scope}/{id}/indicators). It loads as one IOC_LIST rule that is never verified: its matches report and never hold.
type Loaded ¶
type Loaded struct {
FeedUUID string
FeedType string
Rules []Rule
Verified bool
// Why the feed is not verified, in one phrase, when it is not.
Unverified string
ETag string
}
Loaded is one fetch's result.
type Rule ¶
type Rule struct {
RuleTable string `json:"ruleTable"`
RuleUUID string `json:"ruleUuid"`
RuleType string `json:"ruleType"`
Name string `json:"name"`
CVE string `json:"cve,omitempty"`
DeployMode string `json:"deployMode"`
Disabled bool `json:"disabled"`
Body string `json:"body"`
}
Rule is one entry of rules.json.
type Source ¶
type Source struct {
// BaseURL is the feed's publicBaseUrl.
BaseURL string
// PublicKey is the pinned key. Nil means every rule loads unverified.
PublicKey ed25519.PublicKey
HTTP *http.Client
// contains filtered or unexported fields
}
Source is one feed the sensor subscribes to.