outcome

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 0 Imported by: 3 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 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.

Revision 2 adds classes that tell why a target was not covered, so the platform does not read a fact about the target as a failure of the scan:

  • name_gone: the name no longer exists (an authoritative NXDOMAIN or NODATA answer);
  • resolver_failed: the name could not be resolved (SERVFAIL, REFUSED, a resolver timeout): ambiguous, it may be the sensor's own DNS;
  • sensor_network_fault: the sensor's own network failed the control probe, so nothing can be said about the target;
  • rate_limited: the target asked the scan to slow down and the task could not finish at the rate it allowed;
  • edge_challenged and edge_blocked: an edge protection (a WAF or CDN) answered with a challenge or a block in place of the service, so the service was not scanned. Failed when the edge started answering during the task, skipped when the task did not run the target because of it.

A target also carries an optional cause side (target, sensor or platform), a short reason for an unreachable target (no_route, filtered, host_down, ...) and the edge vendor. They are additive: a receiver that does not know them ignores them, and Legacy gives the entry a receiver of revision 1 accepts. A sensor sends revision 2 entries only to a platform that advertised them; an entry with a class the receiver does not know is never read as done.

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

View Source
const (
	MaxReasonLen = 64
	MaxVendorLen = 32
)

Bounds of the free-form members of a Target.

View Source
const MaxTargetLen = 2048

MaxTargetLen bounds one target value in an outcome.

View Source
const MaxTargets = 100000

MaxTargets bounds the outcomes one result may carry; Normalize reads no more entries than this.

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

View Source
const Revision = 2

Revision is the revision of this contract: 1 is the original states and classes, 2 adds the classes, cause, reason and vendor described above. A platform advertises the revision it accepts; a sensor sends no newer one.

Variables

This section is empty.

Functions

func Remaining

func Remaining(reported []Target, taskTargets []string) []string

Remaining returns the task targets (distinct, in task order) that reported does not settle: what is handed out again.

Types

type Cause

type Cause string

Cause says whose side a not-covered target is on. Only sensor and platform causes are faults of the scan; a target-side outcome is an observation about the asset.

const (
	CauseTarget   Cause = "target"
	CauseSensor   Cause = "sensor"
	CausePlatform Cause = "platform"
)

Causes.

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.

const (
	// NameGone: the name does not exist any more (authoritative NXDOMAIN or
	// NODATA). A fact about the target.
	NameGone Class = "name_gone"
	// ResolverFailed: the name could not be resolved (SERVFAIL, REFUSED, a
	// resolver timeout). Ambiguous: the resolver may be the sensor's.
	ResolverFailed Class = "resolver_failed"
	// SensorNetworkFault: the sensor's own network failed the control probe.
	// A fault of the sensor, never a fact about the target.
	SensorNetworkFault Class = "sensor_network_fault"
	// RateLimited: the target pushed back and the task could not finish at
	// the rate it allowed.
	RateLimited Class = "rate_limited"
)

Classes of a failed target added in revision 2.

const (
	EdgeChallenged Class = "edge_challenged"
	EdgeBlocked    Class = "edge_blocked"
)

Classes of a failed or skipped target added in revision 2: an edge protection answered in place of the service.

const (
	Refused  Class = "refused"
	Excluded Class = "excluded"
)

Classes of a skipped 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.

func Count

func Count(outcomes []Target) Counts

Count counts the states of outcomes (invalid entries are not counted).

type State

type State string

State is how a target ended.

const (
	Done       State = "done"
	Failed     State = "failed"
	Skipped    State = "skipped"
	Unfinished State = "unfinished"
)

States.

type Target

type Target struct {
	Target string `json:"target"`
	State  State  `json:"state"`
	Class  Class  `json:"class,omitempty"`
	Cause  Cause  `json:"cause,omitempty"`
	Reason string `json:"reason,omitempty"`
	Vendor string `json:"vendor,omitempty"`
}

Target is one target's outcome. Cause, Reason and Vendor are optional (revision 2): Reason refines an unreachable target (no_route, filtered, host_down, ...) and Vendor names the edge that answered in its place.

func Normalize

func Normalize(reported []Target, taskTargets []string) []Target

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.

func (Target) Fault

func (t Target) Fault() bool

Fault reports whether the outcome is a fault of the scan (a sensor or platform cause) and not an observation about the target.

func (Target) Legacy

func (t Target) Legacy() Target

Legacy returns the entry as a receiver of revision 1 accepts it: a class it does not know becomes the closest one it does, and the added members are dropped. The result is still never done, so the target is not read as covered.

func (Target) Settled

func (t Target) Settled() bool

Settled reports whether the outcome settles its target (done, failed or skipped): the target is not handed out again in the same run.

func (Target) Side

func (t Target) Side() Cause

Side is the cause side of the outcome: the reported Cause when it is valid, else the one its class implies (sensor_network_fault is the sensor's; a refused or excluded target is the platform's policy; every other failed or skipped class is a fact about the target; done and unfinished have none).

func (Target) Valid

func (t Target) Valid() bool

Valid reports whether the outcome is well formed: a non-empty target of at most MaxTargetLen bytes, a known state, and a class that fits it (failed and skipped need one of theirs; done and unfinished take none).

Jump to

Keyboard shortcuts

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