Documentation
¶
Overview ¶
Package tooloption is the shared vocabulary of tool execution options: the few knobs almost every scan tool has (per-request timeout, request rate, concurrency, retries), defined once so that every tool, the sensor SDK and the platform mean the same thing by each name.
A tool declares its options in the configuration schema of its tool manifest (tool.yaml "config", the closed JSON Schema subset of the settings contract). A property that is one of the common options says so with "x-octm-common": "<name>"; its type must be the common option's type and its bounds must lie inside the common bounds (CheckProperty). Every other property is specific to the tool.
Narrowing. Settings are layered: platform defaults, tenant policy, the sensor's configuration, the scan or workflow step, and the platform's decision for one job. For an option that narrows down (rate, concurrency, retries), a layer closer to the job may only lower the value an earlier layer set, never raise it (NarrowValue). The sensor's local policy can lower it again. Timeout does not narrow: a scan may wait longer for a slow target, within the common bounds and the task's own budget.
Reserved names. How a tool's traffic leaves the sensor (proxy) and how its requests identify themselves (user agent, extra headers) are set by the platform's egress and HTTP policy, never by a tool option, so a tool may not declare a property with one of these names (Reserved).
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 what an option means.
Index ¶
Constants ¶
const ( // NarrowNone: any layer may set any value within the bounds. NarrowNone = "" // NarrowDown: a later layer may only lower the value an earlier layer // set. NarrowDown = "down" )
Narrowing directions.
const ( UnitSeconds = "seconds" UnitPerSecond = "per_second" UnitCount = "count" )
Units of an option's value.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option struct {
// Name is the property name a tool uses ("rate").
Name string `json:"name"`
// Type is the JSON Schema type of the value; every common option is an
// integer.
Type string `json:"type"`
// Unit of the value.
Unit string `json:"unit"`
// Minimum and Maximum bound the value (inclusive). A tool may only
// narrow them.
Minimum int64 `json:"minimum"`
Maximum int64 `json:"maximum"`
// Narrow is NarrowNone or NarrowDown.
Narrow string `json:"narrow,omitempty"`
// Title and Description are the English text; user interfaces look up
// their own translation by name.
Title string `json:"title"`
Description string `json:"description"`
}
Option is one common option.
func (Option) CheckProperty ¶
CheckProperty checks that a tool's property declared as this option is compatible with it: the same type, and bounds (when given) inside the common bounds. A property without bounds takes the common ones.
func (Option) NarrowValue ¶
NarrowValue returns the value a later layer's value comes to, given the value an earlier layer set: for an option that narrows down, the lower of the two; otherwise the later value. ok is false when the later value had to be lowered (callers that validate refuse it; callers that run clamp to the returned value).