uplink

package
v3.154.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: AGPL-3.0 Imports: 11 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 uplink is the runtime sensor's client for the vdb-site runtime routes (docs/runtime-sensor-api.md there): register with the rules it compiled, post rule matches and holds, and long-poll decisions.

It authenticates with the org's ApiKey through pkg/auth, so a sensor holds the same credential the CLI does and can never make a decision: the site refuses decisions from an ApiKey.

Index

Constants

View Source
const DefaultEndpoint = "https://www.vulnetix.com/api/site"

DefaultEndpoint is the site API.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Endpoint string
	Creds    *auth.Credentials
	HTTP     *http.Client
	Version  string
}

Client talks to /v1/runtime.

func (*Client) PollDecisions

func (c *Client) PollDecisions(ctx context.Context, sensorKey string, since int64, wait time.Duration) ([]Decision, int64, error)

PollDecisions waits up to wait for decisions after since, and returns them with the cursor to poll from next.

func (*Client) PostEvents

func (c *Client) PostEvents(ctx context.Context, sensorKey string, events []Event) (int, []string, error)

PostEvents sends at most 500 events. It returns how many the server stored and the ones it refused, by index and reason.

func (*Client) PostInventory added in v3.142.0

func (c *Client) PostInventory(ctx context.Context, sensorKey string, packages []InventoryPackage) (int, error)

PostInventory replaces the sensor's in-use package report.

func (*Client) Register

func (c *Client) Register(ctx context.Context, r Registration) (string, error)

Register upserts the sensor and returns its server uuid.

type Decision

type Decision struct {
	UUID        string `json:"uuid"`
	RuleTable   string `json:"ruleTable"`
	RuleUUID    string `json:"ruleUuid"`
	SensorScope string `json:"sensorScope"`
	Subject     string `json:"subject"`
	Verdict     string `json:"verdict"`
	Value       string `json:"value,omitempty"`
	DecidedAt   int64  `json:"decidedAt"`
	Until       int64  `json:"until,omitempty"`
	RevokedAt   int64  `json:"revokedAt,omitempty"`
}

Decision is what a person decided.

type Event

type Event struct {
	EventKey      string         `json:"eventKey"`
	RuleTable     string         `json:"ruleTable"`
	RuleUUID      string         `json:"ruleUuid"`
	Lane          string         `json:"lane"`
	SubjectKind   string         `json:"subjectKind"`
	Subject       string         `json:"subject"`
	Action        string         `json:"action"`
	HoldExpiresAt int64          `json:"holdExpiresAt,omitempty"`
	Detail        map[string]any `json:"detail,omitempty"`
	ObservedAt    int64          `json:"observedAt"`
}

Event is one rule match or hold.

type InventoryPackage added in v3.142.0

type InventoryPackage struct {
	Name      string   `json:"name"`
	Version   string   `json:"version"`
	Ecosystem string   `json:"ecosystem"`
	State     string   `json:"state"`
	Processes int      `json:"processes"`
	Examples  []string `json:"examples,omitempty"`
}

InventoryPackage is one package running processes map.

type Registration

type Registration struct {
	SensorKey     string          `json:"sensorKey"`
	ComputeKind   string          `json:"computeKind"`
	ResourceArn   string          `json:"resourceArn,omitempty"`
	Hostname      string          `json:"hostname"`
	Mode          string          `json:"mode"`
	Version       string          `json:"version"`
	KernelVersion string          `json:"kernelVersion,omitempty"`
	Capabilities  map[string]bool `json:"capabilities"`
	RulesetEtag   string          `json:"rulesetEtag,omitempty"`
	// RuleLoads nil leaves the server's list as it is; an empty slice says
	// the sensor loads nothing. Encoded by Register.
	RuleLoads []RuleLoad `json:"-"`
}

Registration is what the sensor says about itself.

type RuleLoad

type RuleLoad struct {
	RuleTable string `json:"ruleTable"`
	RuleUUID  string `json:"ruleUuid"`
	Status    string `json:"status"` // compiled | rejected | no-engine
	Reason    string `json:"reason,omitempty"`
	Mode      string `json:"mode"` // block | log
}

RuleLoad is whether the sensor compiled one rule.

Jump to

Keyboard shortcuts

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