Documentation
¶
Overview ¶
Package outcome is the per-target outcome of a scan task: how each of the task's targets ended. A sensor reports one outcome per target when a task ends (completed, partial or stopped part-way); the platform settles every target that has an outcome and hands only the unfinished ones out again, so a task that stopped after part of its work never runs the finished targets a second time.
States:
- done: the target was scanned (whatever it found, nothing included);
- failed: the tool tried the target and it failed, with a class: unreachable (no answer, no route, no name), timeout (the target's own time budget ran out), tool_error (the tool failed on that target) or egress_refused (the sensor's network confinement refused every connection the tool made toward the target: it was not reached, and nothing can be said about it);
- skipped: the target was not run on purpose, with a class: refused (a policy refused it) or excluded (the job's exclusions cover it);
- unfinished: the task stopped before the target got an outcome.
Done, failed and skipped settle a target: retrying it would give the same answer, so it is not handed out again in the same run. Unfinished is the only state that asks for another attempt.
The platform never trusts a sensor's list as is. Normalize reads it against the task's own target list: a target the task does not carry is dropped (a sensor can never add work), an entry with an unknown state or class is ignored, and a task target with no valid entry is unfinished.
The package is part of the CTIS contract (standard library only): the platform and the sensor SDK both import it, so neither depends on the other for this shape.
Index ¶
Constants ¶
const MaxTargetLen = 2048
MaxTargetLen bounds one target value in an outcome.
const MaxTargets = 100000
MaxTargets bounds the outcomes one result may carry; Normalize reads no more entries than this.
const ResultKey = "target_outcomes"
ResultKey is the member of a command result (and the property of a CTIS report) that carries the task's per-target outcomes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Class ¶
type Class string
Class says why a target failed or was skipped.
const ( Unreachable Class = "unreachable" Timeout Class = "timeout" ToolError Class = "tool_error" // EgressRefused: the sensor's own egress confinement refused every // connection toward the target. It settles the target like the other // failures (the same sensor would refuse it again); a receiver shows it // as "not reached", never as "nothing found". EgressRefused Class = "egress_refused" )
Classes of a failed target.
type Counts ¶
type Counts struct {
Done int `json:"done"`
Failed int `json:"failed"`
Skipped int `json:"skipped"`
Unfinished int `json:"unfinished"`
}
Counts is how many targets ended in each state.
type Target ¶
type Target struct {
Target string `json:"target"`
State State `json:"state"`
Class Class `json:"class,omitempty"`
}
Target is one target's outcome.
func Normalize ¶
Normalize returns exactly one outcome per distinct task target, in task order: the first valid entry of reported for that target, else unfinished. Entries for targets the task does not carry and invalid entries are dropped; at most MaxTargets entries of reported are read.