feed

package
v4.24.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const RuleTypeIOCList = "IOC_LIST"

RuleTypeIOCList is the rule type of an indicator list the site serves.

View Source
const UnverifiedIndicators = "served by the site; indicator lists report and never block"

UnverifiedIndicators is why an indicator list is never verified.

Variables

View Source
var ErrNotModified = errors.New("feed not modified")

ErrNotModified is returned when the manifest has not changed since the last successful fetch.

View Source
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

func IndicatorRuleUUID(ref string) string

IndicatorRuleUUID is the rule uuid an indicator list loads under, stable for the reference so the console keeps one row per feed.

func IsIndicatorRef

func IsIndicatorRef(ref string) bool

IsIndicatorRef is whether ref names an indicator list the site serves: catalog:<id> or org:<uuid>.

func ParsePublicKey

func ParsePublicKey(encoded string) (ed25519.PublicKey, error)

ParsePublicKey reads a pinned key: base64 of the 32 raw bytes.

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.

func (*Indicators) Fetch

func (s *Indicators) Fetch(ctx context.Context) (Loaded, error)

Fetch reads the list, with ?etag= and If-None-Match from the last good fetch, so an unchanged list costs a 304.

func (*Indicators) Ref

func (s *Indicators) Ref() string

Ref is the reference.

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.

func (*Source) Fetch

func (s *Source) Fetch(ctx context.Context) (Loaded, error)

Fetch reads the feed. It returns ErrNotModified when the manifest's ETag is unchanged, so a poll costs one conditional request.

func (*Source) Ref

func (s *Source) Ref() string

Ref is the feed's base URL.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL