feed

package
v3.152.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: AGPL-3.0 Imports: 12 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

This section is empty.

Variables

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

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

Functions

func ParsePublicKey

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

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

Types

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.

Jump to

Keyboard shortcuts

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