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
- type Client
- func (c *Client) PollDecisions(ctx context.Context, sensorKey string, since int64, wait time.Duration) ([]Decision, int64, error)
- func (c *Client) PostEvents(ctx context.Context, sensorKey string, events []Event) (int, []string, error)
- func (c *Client) Register(ctx context.Context, r Registration) (string, error)
- type Decision
- type Event
- type Registration
- type RuleLoad
Constants ¶
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 ¶
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.
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 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.