Documentation
¶
Index ¶
- Constants
- Variables
- func AdmissionTally(adm TargetAdmission) database.TargetTally
- func ApplyDefaultScanBudget(settings *config.Settings, opts *types.Options)
- func ApplyDirectPhaseNote(c database.ScanCompletion, code string) database.ScanCompletion
- func ApplyDirectPhaseReason(c database.ScanCompletion, reason string) database.ScanCompletion
- func ApplyIntensityAndProfile(settings *config.Settings, opts *types.Options, req ProfileRequest) (string, error)
- func ApplyNativePhaseSelection(opts *types.Options, setExtensions func(enabled bool)) error
- func ApplyRequestBudget(c database.ScanCompletion, b *egress.Budget) database.ScanCompletion
- func ApplySafePreset(settings *config.Settings, opts *types.Options) error
- func ApplyScanPace(settings *config.Settings, opts *types.Options, explicit ExplicitPace) error
- func ApplyScanSettingOverrides(settings *config.Settings, opts *types.Options)
- func CapModulesAtTier(active []modules.ActiveModule, passive []modules.PassiveModule, rank int) ([]modules.ActiveModule, []modules.PassiveModule, []string)
- func DescribeRejected(rejected []TargetVerdict, limit int) string
- func DirectScanCompletion(rep core.ExecutionReport, reached, interrupted bool, execErr error, ...) database.ScanCompletion
- func DirectScanErrorMessage(execErr error, c database.ScanCompletion) string
- func DirectTargetTally(target string, rep core.ExecutionReport, failures []core.BaselineFailure) database.TargetTally
- func DiscoveryBudget(settings *config.Settings, options *types.Options) time.Duration
- func FormatBlockNoticeLine(n http.BlockNotice) string
- func FormatEdgePaceLine(n hostlimit.PreArmNotice) string
- func HygieneBannerCounts(opts *types.Options, settings *config.Settings, active []modules.ActiveModule, ...) (activeCount, passiveCount int, note string)
- func HygieneGateActive(opts *types.Options, settings *config.Settings) bool
- func IsNativePhaseSpelling(s string) bool
- func IsOnlyPhaseSpelling(s string) bool
- func IsProbeOnlyRun(opts *types.Options) bool
- func IsSkippablePhaseSpelling(s string) bool
- func MaxModuleTierRank(opts *types.Options, settings *config.Settings) int
- func NormalizeNativePhase(phase string) string
- func Offline(flag bool, settings *config.Settings) bool
- func OnlyPhaseSet(raw string) map[string]bool
- func PhaseLabel(settings *config.Settings, name, phaseKey string, enabled bool, ...) string
- func PhaseNamesDesc(forSkip bool) string
- func PhaseSpeedDetail(settings *config.Settings, phaseKey string, effective time.Duration) string
- func PhaseVocabularyLines(forSkip bool) []string
- func ProxyUnreachableHint(cliProxy string, unreachable []database.TargetIssue) string
- func ResolvePlan(ctx context.Context, in PlanInput) (*scanplan.Plan, error)
- func RiskyPayloadsAllowed(opts *types.Options, settings *config.Settings) bool
- func SessionStatusPath(sessionsDir, scanUUID string) string
- func SessionStopPath(sessionsDir, scanUUID string) string
- func SpiderFanOutReason(targetCount int) string
- func SpiderFanOutSuggestion(opts *types.Options, targetCount int) (flags string, ok bool)
- func SpideringBudget(settings *config.Settings, options *types.Options) time.Duration
- func SpideringFloor(derived, scanMax time.Duration) time.Duration
- func SpideringGrace(perTarget time.Duration) time.Duration
- func ValidateMaxModuleTier(name string) error
- func WithholdRiskHigh(active []modules.ActiveModule, passive []modules.PassiveModule) ([]modules.ActiveModule, []modules.PassiveModule, []string)
- func WriteSentinel(dir, filename, by string) (string, error)
- func WriteStopSentinel(sessionsDir, scanUUID, by string) (string, error)
- type AuthLostError
- type ExplicitPace
- type ExtensionLoadError
- type Heartbeat
- type HeartbeatConfig
- type HeuristicsResult
- type LaunchParams
- type LaunchResult
- type ModuleSelection
- type NativePhase
- type NativePhaseStep
- type NativeScanPlan
- type PhaseSpelling
- type PlanInput
- type ProfileRequest
- type ResolvedPace
- type ResolvedStrategy
- type ResumeDiff
- type ResumeError
- type Runner
- func (r *Runner) Close()
- func (r *Runner) Completion() database.ScanCompletion
- func (r *Runner) Discard()
- func (r *Runner) Finalized() bool
- func (r *Runner) Hurry()
- func (r *Runner) IsPaused() bool
- func (r *Runner) LiveProgress() (phase string, progress *SessionProgress, findings int64)
- func (r *Runner) ModuleErrors() map[string]int64
- func (r *Runner) ModuleStats() map[string]database.ModuleStat
- func (r *Runner) Pause()
- func (r *Runner) PauseState() string
- func (r *Runner) Resume()
- func (r *Runner) RunNativeScan() (err error)
- func (r *Runner) ScanLogger() *database.ScanLogger
- func (r *Runner) SetRepository(repo *database.Repository)
- func (r *Runner) SetSettings(s *config.Settings)
- func (r *Runner) StopRequestedBy() string
- type SessionProgress
- type SessionStatus
- type StopRequest
- type StrategyRequest
- type TargetAdmission
- type TargetVerdict
- type TargetsRejectedError
- type TargetsUnreachableError
Constants ¶
const ( SessionRunning = "running" SessionCompleted = "completed" SessionFailed = "failed" SessionCancelled = "cancelled" )
Session status values written to status.json. "running" while the heartbeat is live; one of the terminal values once the scan has finalized.
const ( PauseStateRunning = "running" PauseStatePausing = "pausing" PauseStatePaused = "paused" )
Pause states reported by PauseState.
const ( NoticeMarkerBlock = "[waf-block-detected]" NoticeMarkerPacing = "[waf-pacing-armed]" )
NoticeMarkerBlock and NoticeMarkerPacing are the bracketed tags the two operator notices are rendered with. Exported because a reader has to find them again in a rendered log (`vigolium log` reprints any that fell above the tail window) — matching on the marker rather than the prose is deliberate, since the prose is a sentence that gets reworded and the marker is what it tags.
const ( CountModulesSelected = "modules_selected" CountModulesExecuted = "modules_executed" )
The module counts the dynamic-assessment phase records on its PhaseOutcome (Counts): how many modules it was handed, and how many distinct ones ran at least once across every round. The CLI's scan document reports them as modules{selected, executed}; a module whose CanProcess rejected every item, or a run whose baseline never answered, executes nothing.
const CountResponsesWhileLoggedOut = database.LimitResponsesWhileLoggedOut
CountResponsesWhileLoggedOut is the PhaseOutcome.Counts key for the responses a phase received while a session was logged out (the work behind them ran unauthenticated). Set alongside the responses_while_logged_out limit.
const ExtensionModulePrefix = "ext-"
ExtensionModulePrefix is the ID prefix every JS/YAML extension module carries (the jsext and yamlext module constructors prepend it to the script's id).
const HeartbeatInterval = 10 * time.Second
HeartbeatInterval is how often a running scan refreshes its liveness record (status.json and the scan row's heartbeat columns). Phase transitions write immediately on top of it.
Ten seconds keeps the write cost negligible (one tiny file rename and one single-row UPDATE) while sitting far inside the two-minute staleness window readers apply, so a live scan can miss several beats under DB contention before anyone calls it abandoned.
const SessionStatusFilename = "status.json"
SessionStatusFilename is the per-scan liveness file the heartbeat keeps in {sessions_dir}/{scan_uuid}/, next to runtime.log.
const SessionStopFilename = "stop"
SessionStopFilename is the stop sentinel a `scan stop` drops into {sessions_dir}/{scan_uuid}/ next to status.json. It is how a scan whose row lives in a scratch database (-S, --db-isolate) — where no other process can see or write the row — still learns it was asked to stop.
const SpideringSourceFlag = "flag"
SpideringSourceFlag marks a per-target spidering budget typed as --spider-max-time (Options.SpideringMaxDurationSource).
Variables ¶
var ( ValidOnlyPhasesDesc = phaseVocabularyDesc(false) ValidSkipPhasesDesc = phaseVocabularyDesc(true) )
ValidOnlyPhasesDesc and ValidSkipPhasesDesc are the human-readable phase lists rendered in --only/--skip validation error messages. Derived from nativePhaseVocabulary rather than hand-written, so a spelling that works can never go unlisted and a listed one can never fail to resolve.
var ErrEmptyModuleSelection = errors.New("module selection matches no module")
ErrEmptyModuleSelection is what the run fails with when an explicit module selection (-m, --module-tag, --module-id) resolves to no module at all, built in or extension. The CLI maps it to exit 2: running zero modules and reporting "completed" read as a clean assessment of a selection that was a typo.
var ErrNoTargetsInScope = errors.New("no targets in scope")
ErrNoTargetsInScope is what RunNativeScan's error wraps when scope admitted none of the scan's CLI targets: nothing was sent. Match it with errors.Is; errors.As on *TargetsRejectedError gives the per-target verdicts.
var ErrNoTargetsReachable = errors.New("no targets reachable")
ErrNoTargetsReachable is what RunNativeScan's error wraps when none of the admitted CLI targets answered the preflight GET: no phase ran. Match it with errors.Is; errors.As on *TargetsUnreachableError gives each target and why.
var ErrPhaseSelection = errors.New("invalid phase selection")
ErrPhaseSelection marks a rejected --only/--skip selection: a misuse of the command line, which the CLI reports as a usage error (exit 2).
var ErrUnknownExtensionModule = errors.New("unknown extension module")
ErrUnknownExtensionModule is what the run fails with when --module-id (or a REST module list) names an ext- ID that no loaded extension carries. It is a command-line mistake, so the CLI maps it to exit 2 (usage_error); it is raised while the infrastructure is built, before any phase sends traffic.
var ErrUnknownStrategy = errors.New("unknown scanning strategy")
ErrUnknownStrategy is returned (wrapped) when a strategy name matches none of the configured strategies. The CLI maps it to a usage error, REST to a 400.
var SafeMethods = []string{"GET", "HEAD"}
SafeMethods are the only methods a --safe scan's module, discovery and browser traffic may use.
Functions ¶
func AdmissionTally ¶ added in v0.5.3
func AdmissionTally(adm TargetAdmission) database.TargetTally
AdmissionTally is the preflight TargetTally for an admission: requested and admitted counts, and each rejected target with its rule as the issue code. Reached is left for the reachability check to fill.
func ApplyDefaultScanBudget ¶ added in v0.5.7
ApplyDefaultScanBudget bounds the whole scan by scanning_pace.scan_max_duration (default 1h; --safe 15m) when no total budget was typed. Run after ApplyScanSettingOverrides: the default caps the scan's wall clock but, unlike a typed --max-time, does not rescale the per-phase budgets (scanning_pace.max_duration × duration_factor).
func ApplyDirectPhaseNote ¶ added in v0.5.7
func ApplyDirectPhaseNote(c database.ScanCompletion, code string) database.ScanCompletion
ApplyDirectPhaseNote records a caveat code on the direct scan's dynamic-assessment outcome without changing its coverage verdict (see PhaseOutcome.Notes).
func ApplyDirectPhaseReason ¶ added in v0.5.3
func ApplyDirectPhaseReason(c database.ScanCompletion, reason string) database.ScanCompletion
ApplyDirectPhaseReason folds a reason the single-request path observed outside the executor's report into a DirectScanCompletion: the dynamic-assessment outcome turns partial with reason, as the Runner's phase tracker records it. Used for oast_unavailable (the out-of-band service could not register, so blind checks were skipped) and scan_budget (--scanning-max-duration ran out). An empty reason returns c unchanged.
The stop reason is kept when something already stopped the scan; otherwise completionOf names the first phase reason, as on the Runner path.
func ApplyIntensityAndProfile ¶ added in v0.5.3
func ApplyIntensityAndProfile(settings *config.Settings, opts *types.Options, req ProfileRequest) (string, error)
ApplyIntensityAndProfile resolves the intensity to its scanning profile, picks the profile (explicit > intensity's > scanning_strategy.scanning_profile), loads it and overlays it onto settings. It sets opts.Intensity and opts.ScanningProfile, and returns the resolved profile path ("" when no profile applied).
An invalid intensity or a profile that cannot be loaded or applied is an error on every entry point. The REST records path used to swallow both and scan without the profile the caller asked for.
func ApplyNativePhaseSelection ¶
ApplyNativePhaseSelection resolves --only / --skip onto opts. setExtensions is how the caller's settings learn the extension decision: called with true when --only lists extension, false on --skip extension. It may be nil.
func ApplyRequestBudget ¶ added in v0.5.3
func ApplyRequestBudget(c database.ScanCompletion, b *egress.Budget) database.ScanCompletion
ApplyRequestBudget folds a request budget's verdict into the completion of a single-request scan (DirectScanCompletion), which has no phase tracker to record it as it happens: hosts that ran out of --max-requests-per-host become the host_request_budget limit and BudgetExhaustedHosts on the assessment, and a scan-wide --max-requests that ran out makes the assessment partial with request_budget — the reason the Runner path records — and, when nothing else stopped the scan first, its stop reason. A nil budget, or one that refused nothing, returns c unchanged.
func ApplySafePreset ¶ added in v0.5.7
ApplySafePreset applies --safe: the embedded overlay (presets/overlays/safe.yaml: low pace, a 15m total budget, strict origin, shallow recursion, no form submission/uploads/logins in the browser, no intrusive known-issue templates), then the parts the code enforces whatever the config says: risky payloads off, traffic limited to SafeMethods, param mining off unless --param-mining was typed.
Order: after ApplyIntensityAndProfile (the overlay narrows the profile) and before ApplyScanSettingOverrides (typed flags still win). A no-op without opts.Safe.
func ApplyScanPace ¶ added in v0.5.3
ApplyScanPace validates scanning_pace, folds its common values into opts for every knob the caller did not set explicitly (scanning_pace is the lowest rung above the built-in defaults), and resolves the discovery and spidering max durations from max_duration × duration_factor.
Run it last — after the strategy ceiling, the phase selection and any per-phase qualifiers — so the values it folds are the final ones.
It also records the caller's explicit knobs on opts, which is where the runner reads them (host limiter, per-phase concurrency, discovery rate); every entry point runs it after ApplyScanStrategy with the same ExplicitPace.
func ApplyScanSettingOverrides ¶ added in v0.5.3
ApplyScanSettingOverrides copies request values that are read from Settings rather than Options. Run it after ApplyIntensityAndProfile: a profile may carry scope and scanning_pace sections, and a value the caller typed outranks the profile's.
opts.ScanMaxDuration plays two roles: it seeds the per-phase duration base (each phase scales scanning_pace.max_duration by its duration_factor) and caps the whole scan's wall clock, so the factors distribute time within the budget rather than stacking past it.
func CapModulesAtTier ¶ added in v0.5.8
func CapModulesAtTier(active []modules.ActiveModule, passive []modules.PassiveModule, rank int) ([]modules.ActiveModule, []modules.PassiveModule, []string)
CapModulesAtTier drops every module above the hard tier ceiling rank (0: no ceiling) and returns the ids it dropped, active then passive.
func DescribeRejected ¶ added in v0.5.3
func DescribeRejected(rejected []TargetVerdict, limit int) string
DescribeRejected renders rejected targets as "target (rule)", comma separated, naming at most limit of them (limit <= 0 names all).
func DirectScanCompletion ¶ added in v0.5.3
func DirectScanCompletion(rep core.ExecutionReport, reached, interrupted bool, execErr error, tally database.TargetTally) database.ScanCompletion
DirectScanCompletion is the coverage verdict for a single-request scan that ran one executor without a Runner: the scan-url / scan-request direct path in the CLI and the REST /api/scan-url and /api/scan-request background scans.
Those used to finish their row with CompleteScan, which writes "unknown", so a cancelled run and a dead target were stored exactly like a clean scan. This builds the two outcomes such a scan has — a preflight outcome carrying the target tally, and one dynamic-assessment outcome from the executor's own report — and judges them by the rule Runner.Completion uses, with the same reason codes, so every surface stores the same verdict for the same run.
- rep is the executor's Report() after Execute returned.
- reached says an admitted target answered (rep.Responded > 0 for one executor). A run that reached nothing, and was not interrupted, stops with no_targets_reachable; its assessment is marked skipped, because no module had a baseline to work on.
- interrupted is an operator/caller cancellation; it outranks every other stop reason because it is the cause of whatever else went missing.
- execErr is Execute's error, counted against the assessment.
- tally is the CLI-target tally (see DirectTargetTally). A zero tally is "not counted" and adds no preflight outcome. Requested targets that scope admitted none of stop with no_targets_in_scope (hook for scope admission on this path, which does not filter yet).
func DirectScanErrorMessage ¶ added in v0.5.3
func DirectScanErrorMessage(execErr error, c database.ScanCompletion) string
DirectScanErrorMessage is the error_message a single-request scan row is completed with; non-empty marks the row failed.
It follows the runner's finalizer: an execution error is reported as itself and a cancelled run as "cancelled" (the runner, too, stores an interrupted scan as failed with that message, its completeness partial). A run that reached no target did nothing, which is a failure, not a clean completion.
func DirectTargetTally ¶ added in v0.5.3
func DirectTargetTally(target string, rep core.ExecutionReport, failures []core.BaselineFailure) database.TargetTally
DirectTargetTally is the target tally for one single-request executor run: one requested target, admitted (a refused one never reaches the executor), and reached when the executor got an HTTP answer — the executor's baseline is the reachability check on this path, so the tally is always checked. An unanswered target carries the first classified baseline failure, so the row says why it did not answer.
func DiscoveryBudget ¶ added in v0.5.2
DiscoveryBudget returns the wall-clock budget one discovery target gets.
Same contract as SpideringBudget, for the phase whose fallback lived inside the input source: option (--discover-max-time, else the scanning_pace value) first, then scanning_pace.discovery.max_duration, then the source's own default. Without this the banner printed the unset option — 0, rendered as no budget at all — while every target ran for the source's default hour.
func FormatBlockNoticeLine ¶
func FormatBlockNoticeLine(n http.BlockNotice) string
FormatBlockNoticeLine renders the one-line WAF/CDN block warning (with a trailing newline) shown when the edge starts filtering scan traffic. It is shared by every scan front-end so the message and the "unnamed refusal" wording stay identical whether the scan runs through the Runner or the direct scan-url/scan-request path.
func FormatEdgePaceLine ¶
func FormatEdgePaceLine(n hostlimit.PreArmNotice) string
FormatEdgePaceLine renders the one-line notice shown when a host is fingerprinted behind a CDN/WAF edge and its active-scan concurrency is proactively paced to keep a burst from arming a rate-based WAF. It spells out the concurrency drop so the operator understands the scan will run slower against that host. Companion to FormatBlockNoticeLine — a caution, not a failure: the scan continues, just gentler.
func HygieneBannerCounts ¶ added in v0.4.9
func HygieneBannerCounts(opts *types.Options, settings *config.Settings, active []modules.ActiveModule, passive []modules.PassiveModule) (activeCount, passiveCount int, note string)
HygieneBannerCounts adjusts a scan banner's module counts for the hardening-advisory gate and returns the note to append, empty when the family runs. One implementation for the two pre-scan banners (CLI and runner).
func HygieneGateActive ¶ added in v0.4.9
HygieneGateActive reports whether a scan with these options and settings suppresses the hardening-advisory family: the resolved policy says no AND the operator has not named one of them explicitly.
Exported because the CLI prints its own pre-scan banner before a Runner exists, and a banner that counts modules the scan will not run makes the gate look like a lost finding. Both banners and the module filter read this.
func IsNativePhaseSpelling ¶
IsNativePhaseSpelling reports whether s names a native scan phase under any accepted spelling. Callers that need to branch on "is this a phase?" ask here rather than re-listing spellings, so a new alias reaches them for free.
func IsOnlyPhaseSpelling ¶ added in v0.5.3
IsOnlyPhaseSpelling reports whether --only (and `run <phase>`) accepts s. Internal steps (seed, harvest-probe, param-mining, preflight) are phase names but not runnable on their own.
func IsProbeOnlyRun ¶
IsProbeOnlyRun reports whether this invocation is a standalone host sweep: `vigolium run probe`, `scan --only probe`, or REST {"only":"probe"}.
The probe's own defaults apply only here. When the phase rides along inside a full scan, the scan's redirect and recording policy governs — silently swapping it out from under the other phases would be a surprise.
func IsSkippablePhaseSpelling ¶ added in v0.5.3
IsSkippablePhaseSpelling reports whether --skip accepts s.
func MaxModuleTierRank ¶ added in v0.5.8
MaxModuleTierRank is maxModuleTierRank for the CLI's direct scan paths.
func NormalizeNativePhase ¶
NormalizeNativePhase maps every accepted spelling of a phase to its canonical id. Input is trimmed and lowercased first: --only already trimmed, --skip did not, so `--skip Discovery` (or ` discovery`) reached the switch verbatim, fell through to default, and was reported as an invalid phase. Aliases are extra surface for a driver to get subtly wrong; normalizing here means every caller — --only, --skip, `run <phase>`, the pace-flag qualifiers, and the scan.started event's canonical phase list — agrees on what a spelling means.
func Offline ¶ added in v0.5.7
Offline reports whether a run is --offline: the flag (flag) or the settings key offline. The one rule every scan path (the Runner, the direct scan path) decides it by.
func OnlyPhaseSet ¶
OnlyPhaseSet returns the set of normalized phases listed in a comma-separated --only value. Callers use it to gate behavior that depends on which phases are active (e.g. validating that --format=html was scoped to phases that produce a report). Returns nil for empty input.
func PhaseLabel ¶ added in v0.4.8
func PhaseLabel(settings *config.Settings, name, phaseKey string, enabled bool, effective time.Duration) string
PhaseLabel renders one entry of the banner's "Phases:" line: a status symbol, the phase name, and the budget it will run with ("Spidering (6m0s, x0.1)").
`--spider-max-time 5m` used to be announced as the profile's 6m0s -- 0.1 x the 1h scan budget -- while the phase went on to crawl for the 5m it was told to.
func PhaseNamesDesc ¶
PhaseNamesDesc renders the canonical phase ids alone, comma-separated. Flag help uses this (the full alias vocabulary is too long for one --help line); the error a wrong value produces quotes ValidOnlyPhasesDesc/ValidSkipPhasesDesc instead, which spells every accepted alias out.
func PhaseSpeedDetail ¶ added in v0.4.8
PhaseSpeedDetail renders the budget fragment a phase prints on its own detail line -- "max-duration=6m0s (duration_factor=0.1)" -- or "" when the phase has no budget. Callers supply the separator, because one of them opens a line with it and the rest append to a list.
A factor never arrives without a duration: ResolvePhase only sets one in the branch that multiplies it into the other.
func PhaseVocabularyLines ¶
PhaseVocabularyLines renders one "canonical (alias, alias)" entry per phase, for help text that lists them vertically. forSkip selects the phases --skip accepts; false selects the phases --only accepts. Returned as lines rather than a joined string because the alias lists are themselves comma-separated — splitting the flat form on ", " to lay it out would break entries apart mid-list.
func ProxyUnreachableHint ¶ added in v0.5.7
func ProxyUnreachableHint(cliProxy string, unreachable []database.TargetIssue) string
ProxyUnreachableHint names the proxy an unreachable target was sent through and where it came from, so a dead proxy is not mistaken for a dead target. "" when none of them went through a proxy.
func ResolvePlan ¶ added in v0.5.3
ResolvePlan resolves the scan plan for already-resolved options and settings. It has no side effects: no file is written (wordlists are sized from the embedded copies, never materialized), no session logs in, no OAST is registered, nothing touches the network, and the database is only read. `scan --dry-run` prints its result; the runner emits it as scan.plan and stores it on the scan row.
func RiskyPayloadsAllowed ¶ added in v0.5.3
RiskyPayloadsAllowed reports whether risk:high payloads and modules run for a scan with these options and settings: always at --intensity deep, otherwise only with the --allow-risky-payloads / config opt-in.
func SessionStatusPath ¶ added in v0.5.3
SessionStatusPath is where the heartbeat writes scanUUID's status.json.
func SessionStopPath ¶ added in v0.5.7
SessionStopPath is where the stop sentinel for scanUUID lives.
func SpiderFanOutReason ¶
SpiderFanOutReason states why a serial crawl is the wrong shape for this target list. Two readings of the same fact: past the budget cap the ceiling is the headline — targets are dropped outright — while below it the only cost is wall clock. Telling an operator with 2 targets that "most won't be reached" is untrue, and a hint that overstates once is discounted from then on.
Rendered here rather than in pkg/cli so it reads spideringPhaseBudgetCap directly: a hardcoded figure in the message would keep printing the old budget after the cap moved, and the operator sizes their fan-out against it.
func SpiderFanOutSuggestion ¶
SpiderFanOutSuggestion returns the flags that would fan a multi-target spidering run out across child processes, and whether the suggestion applies.
It exists because spidering is the one phase where the pace flags cannot help. It drives a browser rather than the executor, so -c/--concurrency (the executor's worker count) never reaches it, and its host loop is strictly serial — one crawl at a time, whatever the flags say. On top of that the phase stops after SpideringPhaseBudgetCap targets' worth of budget, so a long -T list is not merely slow, most of it is never reached: an operator who asked for 682 hosts gets about eight and a skip warning at the end. The only real parallelism available is the -P fan-out, which runs each target as its own process with its own browser and its own ceiling.
Every condition here mirrors one the -P fan-out itself enforces, because a hint naming a command that gets rejected — or silently degraded back to one serial scan — is worse than no hint. validateParallelScan admits -P > 1 only under --db-isolate or -S --split-by-host (anything else would share a database or an output file across concurrent scans), and needs a -T file to split in the first place: a -t-only or piped run has nothing to fan out and is warned back down to Parallel = 1. Suggesting --db-isolate to a -S run is pointless for a different reason — runScanCmd drops the flag with a warning there, leaving -P to fail the gate anyway. Flags already present are not repeated back.
Lives here rather than in pkg/cli because both the pre-scan banner hint and the phase's own ceiling-reached line quote it, and pkg/cli imports this package (not the reverse) — one owner, so the two can never suggest different flags.
func SpideringBudget ¶ added in v0.4.8
SpideringBudget returns the wall-clock budget one spidering target gets.
It exists so the phase and the banner cannot answer this differently. The budget comes from the option when set (--spider-max-time, else the scanning_pace value runNativeScan copies in) and otherwise from spidering.max_duration, a separate config key -- and a banner that read only one of those advertised a budget the phase would not use, which is the defect this whole file exists to close. runSpideringPhase calls it too.
It is also the one owner of the spidering FLOOR: a budget DERIVED from scanning_pace (max_duration × duration_factor, Source "factor") is raised to SpideringFloor, because the 0.1 factor turns a short --scanning-max-duration into a crawl too brief to log in and settle a single SPA (4m → 24s). An explicit value — --spider-max-time, scanning_pace.spidering.max_duration, spidering.max_duration — is never adjusted.
func SpideringFloor ¶ added in v0.5.3
SpideringFloor applies the floor to a factor-derived per-target budget: max(derived, 60s), where the 60s is itself capped at half the total scan budget (scanMax, --scanning-max-duration; 0 = none) so the crawl can never take more than half of a short scan. A derived value above the floor is returned unchanged.
func SpideringGrace ¶ added in v0.5.3
SpideringGrace is the drain window before a target's crawl deadline: the crawler stops scheduling new states this long before the deadline, so in-flight navigations and the capture writer finish inside the budget instead of being cut off by it. min(10s, 10% of the per-target budget).
func ValidateMaxModuleTier ¶ added in v0.5.8
ValidateMaxModuleTier refuses a --max-module-tier or dynamic-assessment.max_module_tier value that names no tier. Empty is valid (no hard ceiling).
func WithholdRiskHigh ¶ added in v0.5.8
func WithholdRiskHigh(active []modules.ActiveModule, passive []modules.PassiveModule) ([]modules.ActiveModule, []modules.PassiveModule, []string)
WithholdRiskHigh drops the risk:high modules from a broad selection, for the direct scan paths that do not go through FilterModulesForRun.
func WriteSentinel ¶ added in v0.5.7
WriteSentinel writes a StopRequest from by as filename inside the existing directory dir (a scan's or agent run's session directory) and returns its path.
func WriteStopSentinel ¶ added in v0.5.7
WriteStopSentinel drops the stop sentinel for scanUUID. The session directory must already exist (the heartbeat created it): a sentinel for a scan that never ran on this host would stop nothing.
Types ¶
type AuthLostError ¶ added in v0.5.3
AuthLostError ends a scan whose session expired, could not be logged in again, and was configured with reauth.on_failure: abort. error.code is login_failed.
func (*AuthLostError) Code ¶ added in v0.5.3
func (e *AuthLostError) Code() apicontract.ErrorCode
Code is the machine error code (see pkg/apicontract).
func (*AuthLostError) Error ¶ added in v0.5.3
func (e *AuthLostError) Error() string
func (*AuthLostError) Unwrap ¶ added in v0.5.3
func (e *AuthLostError) Unwrap() error
type ExplicitPace ¶ added in v0.5.3
type ExplicitPace struct {
Concurrency bool
RateLimit bool
MaxPerHost bool
// ExternalHarvest keeps the caller's opts.ExternalHarvestEnabled instead of
// the strategy's external_harvesting (`--intensity balanced --external-harvest`).
ExternalHarvest bool
// DiscoverMaxDuration / SpideringMaxDuration keep the caller's per-phase
// duration instead of the scanning_pace-resolved one.
DiscoverMaxDuration bool
SpideringMaxDuration bool
// MaxRequests / MaxRequestsPerHost keep the caller's request budget instead
// of scanning_pace.max_requests / max_requests_per_host.
MaxRequests bool
MaxRequestsPerHost bool
}
ExplicitPace says which pace knobs the caller set itself. Those are never narrowed by a strategy ceiling and never replaced by scanning_pace values: an explicit --concurrency 40 alongside --strategy lite is an operator overruling the preset, which is the point of having both.
type ExtensionLoadError ¶ added in v0.5.3
type ExtensionLoadError struct {
Failures []jsext.LoadFailure
}
ExtensionLoadError is the scan's error when an extension the user named directly (--ext, extensions.custom_dir) failed to load and --ext-allow-failures was not given. It is returned before any target traffic, so a dropped extension can never make a scan look clean. The CLI exits 2 with error.code extension_load_failed.
func (*ExtensionLoadError) Code ¶ added in v0.5.3
func (e *ExtensionLoadError) Code() apicontract.ErrorCode
Code reports the stable error code (see classifyErrorCode in pkg/cli).
func (*ExtensionLoadError) Error ¶ added in v0.5.3
func (e *ExtensionLoadError) Error() string
type Heartbeat ¶ added in v0.5.3
type Heartbeat struct {
// contains filtered or unexported fields
}
Heartbeat keeps one scan's liveness record fresh: status.json every interval and on every phase transition, and the scans row's heartbeat columns alongside it. Always on — it is not tied to --events or persist_logs — so `scan status`, `scan wait` and `log ls` can tell a live scan from one whose process died, which a status column alone never could.
Every method is nil-safe, so callers need no guard when a scan runs without one.
func StartHeartbeat ¶ added in v0.5.3
func StartHeartbeat(cfg HeartbeatConfig) *Heartbeat
StartHeartbeat writes the first beat synchronously, so a reader that looks the moment the scan starts already finds it, then keeps beating until Stop or Finish.
func (*Heartbeat) Finish ¶ added in v0.5.3
Finish stops the heartbeat (if Stop has not) and records the terminal status in status.json. Call it after the scan row is finalized, so the file never claims an end the row does not yet show.
func (*Heartbeat) PhaseEnded ¶ added in v0.5.3
PhaseEnded records phase as done. extraSent is what the phase sent through counters the Requests func reads only while the phase is current, folded in here so the scan-wide figure does not drop when the phase ends.
func (*Heartbeat) PhaseStarted ¶ added in v0.5.3
PhaseStarted records the phase now running and beats.
func (*Heartbeat) RecordFinding ¶ added in v0.5.3
RecordFinding counts one finding at severity (lowercase name).
type HeartbeatConfig ¶ added in v0.5.3
type HeartbeatConfig struct {
// Repo receives the scans-row heartbeat; nil writes the file only.
Repo *database.Repository
ScanUUID string
// SessionsDir is the native sessions root; "" writes the row only.
SessionsDir string
ProjectUUID string
DBPath string
// Phase is the initial phase, for a caller with a single fixed phase.
Phase string
PhasesPlanned []string
ScanMaxDuration time.Duration
// Requests reports requests sent so far by sources the heartbeat does not
// track itself; nil reports none (and leaves total_requests unwritten).
Requests func() int64
// Progress reports the running phase's work-item progress; nil for none.
Progress func() *SessionProgress
// StopWhenRowDone ends the heartbeat by itself once its scan row is no
// longer running (someone else finalized it), recording the row's
// terminal status in status.json. For callers that finalize the row
// without a handle on the heartbeat (the direct scan-url path).
StopWhenRowDone bool
// OnStopRequest is called once, from the heartbeat goroutine, when a stop
// request arrives: the row's stop_requested_at or the session's stop
// sentinel. nil ignores stop requests.
OnStopRequest func(StopRequest)
// Interval and Now are for tests; zero values mean HeartbeatInterval and
// time.Now.
Interval time.Duration
Now func() time.Time
}
HeartbeatConfig wires a Heartbeat to the scan it reports on.
type HeuristicsResult ¶
type HeuristicsResult struct {
Target string
StatusCode int16
ContentType string // "blank", "html", "json", "xml", "text"
BodyLength int
LinkCount int // advanced only
IsSPA bool // advanced only
SkipSpidering bool
Reason string
// Reachable is true when the root answered with an HTTP response (any
// status). False with ErrClass set when it did not.
Reachable bool
// ErrClass is the transport error class (http.TransportErr*) when the root
// did not answer: dns, refused, timeout, tls, reset or other.
ErrClass string
// contains filtered or unexported fields
}
HeuristicsResult holds the analysis of a single target's root page.
type LaunchParams ¶
type LaunchParams struct {
// Targets lists URLs / file paths the scan should ingest. Required.
Targets []string
// ProjectUUID scopes the scan and selects the project config overlay
// layered over the global settings. Empty leaves it unscoped (global
// settings only) — the same behavior as `vigolium scan-url` without
// --project.
ProjectUUID string
// Modules optionally narrows the active-module set. Empty = no
// restriction (CLI default).
Modules []string
// PassiveModules narrows the passive set. Empty = ["all"].
PassiveModules []string
// ExtensionPaths supplies extra JS extension files to load alongside
// any built-ins. Each path is appended to ExtensionsConfig.CustomDir
// before the runner builds its phase infra.
ExtensionPaths []string
// ExtensionsOnly skips all built-in Go modules; runs only JS
// extensions. Used by run_extension when the agent wants its supplied
// script to run in isolation.
ExtensionsOnly bool
// ScanningStrategy selects a named strategy ("lite", "balanced",
// "deep"). Empty inherits the settings default.
ScanningStrategy string
// ScanMaxDuration caps total wall-clock time for the whole native scan.
// Zero leaves the scan unbounded (it runs until ctx cancellation) — which
// is a foot-gun for library callers like the autopilot pre-scan that share
// a long-lived ctx: an unbounded scan will consume the entire budget and
// starve whatever runs after it. Set a bounded value for such callers.
ScanMaxDuration time.Duration
// EnableDiscovery turns on the discovery phase. Default false — most
// agent invocations want a targeted dynamic-assessment-only scan.
EnableDiscovery bool
// EnableSpidering turns on browser-based spidering. Default false.
EnableSpidering bool
// ConfigPath overrides the path to vigolium-configs.yaml. Empty =
// default search order.
ConfigPath string
// Repository is the DB handle used for persistence and final result
// readback. Nil is allowed — the scan still runs but results aren't
// persisted and LaunchResult fields will be zero.
Repository *database.Repository
// Concurrency overrides the worker count. 0 = settings default.
Concurrency int
// OnlyPhase, when non-empty, isolates one or more phases via the same
// comma-separated syntax `vigolium scan --only` accepts (e.g.
// "discovery", "dynamic-assessment", "discovery,dynamic-assessment").
// Phase aliases (deparos, dast, ext, etc.) are accepted and normalized.
// Empty preserves the default phase plan derived from settings.
OnlyPhase string
// SkipPhases disables one or more phases while keeping the rest of the
// plan intact. Mutually exclusive with OnlyPhase. Same alias normalization.
SkipPhases []string
// SkipIngestion skips the discovery ingestion phase. When you've already
// got records in the project and just want to (re)run dynamic-assessment
// against them, set this true and the runner will scan existing records
// instead of crawling new ones.
SkipIngestion bool
// AuthFiles are native session files, as `vigolium scan --auth-file`
// takes: the scan logs them in and sends the primary session's
// credentials (and persists the sessions for the project's targets).
AuthFiles []string
}
LaunchParams configures a one-shot scan started from a library caller. The intended consumer is the olium agent's run_native_scan / run_extension tools — anything that wants to drive a scan without rebuilding the full CLI option matrix. Only Targets is required; the rest fall back to sensible defaults.
type LaunchResult ¶
type LaunchResult struct {
ScanUUID string
Status string
FindingCount int64
TotalRequests int64
Critical int64
High int64
Medium int64
Low int64
Info int64
Suspect int64
DurationMs int64
}
LaunchResult summarizes a completed scan. Populated from the Scan DB row after RunNativeScan returns. When Repository is nil at launch time, only ScanUUID and DurationMs are populated.
func LaunchScan ¶
func LaunchScan(ctx context.Context, params LaunchParams) (*LaunchResult, error)
LaunchScan runs a single scan synchronously. Blocks until RunNativeScan returns (success, failure, or ctx cancellation).
The scan UUID is generated up-front so callers can correlate post-hoc even if the run errors before any work is recorded — the UUID is real and queryable from the moment LaunchScan is invoked.
type ModuleSelection ¶ added in v0.5.3
type ModuleSelection struct {
Active []modules.ActiveModule
Passive []modules.PassiveModule
// TierCeiling is the intensity's tier rank ceiling.
TierCeiling int
// MaxTier is the hard tier ceiling (--max-module-tier /
// dynamic-assessment.max_module_tier), 0 when none; TierCapped lists the
// module ids it removed, active then passive. Unlike TierDeferred it binds
// explicit selections too.
MaxTier int
TierCapped []string
// ActiveByConfig / PassiveByConfig report a dynamic-assessment
// enabled_modules allowlist narrowing an "all" selection.
ActiveByConfig, PassiveByConfig bool
// ConfigDisabled lists the module ids the enabled_modules deny-lists
// removed from an "all" selection, active then passive.
ConfigDisabled []string
// Dropped module ids per gate, active then passive.
TierDeferred []string
RiskWithheld []string
HygieneSuppressed []string
// contains filtered or unexported fields
}
ModuleSelection is the built-in module set a run executes, plus what the broad-selection gates dropped and why. FilterModulesForRun builds it; the runner (getModulesToExecute) and the scan plan (ResolvePlan) both read it, so the plan's module counts are the runner's by construction.
func FilterModulesForRun ¶ added in v0.5.3
func FilterModulesForRun(opts *types.Options, settings *config.Settings) ModuleSelection
FilterModulesForRun resolves the built-in modules a scan with these options and settings runs. Pure: no logging, no I/O.
Sentinel convention for opts.Modules / opts.PassiveModules: a nil/empty slice selects ZERO modules for that category; []string{"all"} selects every module; any other list selects those IDs. Callers disable a whole category by leaving its slice empty — e.g. scan-url's --no-passive nils PassiveModules and server's --passive-only nils Modules. Do not make an empty slice default to "all" without updating those callers.
The gates below (config allowlist, intensity tier ceiling, risk:high withholding, hardening advisories) only narrow a broad ("all") selection: an explicit -m / --module-tag list or a config allowlist reflects deliberate intent and runs verbatim.
type NativePhase ¶
type NativePhase string
const ( PhaseHeuristicsCheck NativePhase = "heuristics-check" PhasePortSweep NativePhase = "port-sweep" PhaseExternalHarvest NativePhase = "external-harvest" PhaseHarvestProbe NativePhase = "harvest-probe" PhaseSpidering NativePhase = "spidering" PhaseProbe NativePhase = "probe" PhaseFingerprint NativePhase = "fingerprint" PhaseDiscovery NativePhase = "discovery" PhaseTargetedReSpider NativePhase = "targeted-respider" PhaseSeed NativePhase = "seed" PhaseParamMining NativePhase = "param-mining" PhaseKnownIssueScan NativePhase = "known-issue-scan" PhaseDynamicAssessment NativePhase = "dynamic-assessment" // PhasePreflight carries the CLI-target tally (scope admission, // reachability) on a scan row. Not a plan step: RunNativeScan runs it // before the first phase whenever the targets are the input (see // preflight.go); --skip preflight turns the reachability GET off. PhasePreflight NativePhase = "preflight" )
type NativePhaseStep ¶
type NativePhaseStep struct {
Phase NativePhase
Enabled bool
// SkipsTarget marks a phase that never sends a request to the scan target.
// Declared here, in the same literal as the phase's own gate, rather than in
// a side table keyed by phase: this file is the single owner of the phase
// vocabulary, and a second per-phase map is exactly how the vocabulary and
// the plan drifted apart before. A new phase has to answer the question
// where it is declared.
SkipsTarget bool
}
type NativeScanPlan ¶
type NativeScanPlan struct {
Steps []NativePhaseStep
}
func BuildNativeScanPlan ¶
func BuildNativeScanPlan(opts *types.Options) NativeScanPlan
func (NativeScanPlan) SendsTargetTraffic ¶ added in v0.5.0
func (p NativeScanPlan) SendsTargetTraffic() bool
SendsTargetTraffic reports whether any enabled step in the plan will send a request to the scan target. Everything but ExternalHarvest reaches it, directly or through the shared requester, and so is affected by session headers and request hooks.
Infrastructure whose only purpose is to shape target traffic is built on the strength of this. Session hydration in particular EXECUTES LOGIN FLOWS, so `vigolium run external-harvest --auth-file admin.yaml` used to authenticate against a host it was never going to touch.
type PhaseSpelling ¶
type PhaseSpelling struct {
Canonical string `json:"canonical"`
Aliases []string `json:"aliases,omitempty"`
Skippable bool `json:"skippable"`
// Internal: scheduled by the plan on its own gates; never accepted by --only.
Internal bool `json:"internal"`
// OnlyAccepted reports whether --only / `run <phase>` accepts this phase.
OnlyAccepted bool `json:"only_accepted"`
}
PhaseSpelling is the public projection of one vocabulary entry, for callers that need the structure rather than a rendered line — notably the machine output of `vigolium strategy`, which is how a caller discovers what --only and --skip accept without parsing help text.
func PhaseVocabulary ¶
func PhaseVocabulary() []PhaseSpelling
PhaseVocabulary returns the accepted phase spellings, derived from the same single table every other consumer reads. Building the machine list here rather than restating it in pkg/cli is what keeps a new phase from being runnable but undiscoverable.
type PlanInput ¶ added in v0.5.3
type PlanInput struct {
Opts *types.Options
Settings *config.Settings
// StrategyName is the strategy that applied ("" = none).
StrategyName string
// Repo is optional and only read: records in scope, the insertion-point
// sample, DB-stored auth sessions. Nil under a dry run with no database.
Repo *database.Repository
// Targets are the targets the scan seeds (CLI, -T lines, a piped URL
// list); nil means Opts.Targets. FromFiles is the -T share.
Targets []string
FromFiles int
// TargetsAreInput says the targets are the scan's input, so scope
// admission and the preflight apply (false for -i, --all-records,
// scan-on-receive).
TargetsAreInput bool
// AllRecords: the stored records are the input (--all-records).
AllRecords bool
// ExtensionCount is the number of extension files that will load, for a
// plan resolved before the extensions are (the CLI's).
ExtensionCount int
// Verbose lists the running module ids.
Verbose bool
// DryRun marks the plan as resolved without running the scan.
DryRun bool
// contains filtered or unexported fields
}
PlanInput is what ResolvePlan resolves a scan plan from: the options and settings AFTER scan-options resolution (resolveNativeScanOptions on the CLI, the same runner functions on REST and launch.go).
type ProfileRequest ¶ added in v0.5.3
type ProfileRequest struct {
// Intensity is quick|balanced|deep; "" means not requested.
Intensity string
// Profile is an explicit scanning profile name or path. It wins over the
// profile the intensity maps to; "" falls back to the intensity's profile,
// then to scanning_strategy.scanning_profile.
Profile string
}
ProfileRequest is the intensity/profile half of a scan request.
type ResolvedPace ¶ added in v0.5.3
type ResolvedPace struct {
Strategy string `json:"strategy"`
Concurrency int `json:"concurrency"`
RateLimit int `json:"rate_limit"`
MaxPerHost int `json:"max_per_host"`
}
ResolvedPace is the invocation-wide pace a resolved scan will run with. REST returns it on the scan-accepted response so a caller sees what will run.
func ResolvedPaceOf ¶ added in v0.5.3
func ResolvedPaceOf(strategy string, opts *types.Options) ResolvedPace
ResolvedPaceOf reports the pace opts carries after ApplyScanPace.
type ResolvedStrategy ¶ added in v0.5.3
type ResolvedStrategy struct {
// Name is the strategy that applied; "" when neither the request nor the
// settings named one (no strategy, phases left as the caller set them).
Name string
Phases config.StrategyPhases
}
ResolvedStrategy is what ApplyScanStrategy settled on.
func ApplyScanStrategy ¶ added in v0.5.3
func ApplyScanStrategy(settings *config.Settings, opts *types.Options, req StrategyRequest) (ResolvedStrategy, error)
ApplyScanStrategy is the one place a strategy turns into Options and pace.
Order: an explicit rate limit is written into scanning_pace first (so known-issue-scan honours it and the ceiling below leaves it alone) → the strategy's phases → the external-harvest override → the strategy's pace ceiling, narrowing only knobs the caller did not set → the heuristics level.
Phase selection (--only/--skip) is NOT applied here: callers run ApplyNativePhaseSelection next, so a selection overrides the strategy.
type ResumeDiff ¶ added in v0.5.7
type ResumeDiff struct {
Field string `json:"field"`
Stored string `json:"stored"`
Requested string `json:"requested"`
}
ResumeDiff is one aspect of the stored scan that differs from the run that would resume it: Field is targets, scope or modules.
func ResumeMismatch ¶ added in v0.5.7
func ResumeMismatch(scan *database.Scan, opts *types.Options, settings *config.Settings) []ResumeDiff
ResumeMismatch compares a stored scan with the run that would resume it, on what the coverage ledger's meaning depends on:
- targets: the row's target list against opts.Targets, as sets;
- scope: the stored plan's scope rules (origin mode, host/path include and exclude, static-file filter, the other non-default rules) against the settings' — skipped when the row has no plan;
- modules: the built-in modules the row's assessment ran against FilterModulesForRun's selection — skipped when the row never reached the assessment. Extension modules are not compared: they are known only once the extension engine is built.
type ResumeError ¶ added in v0.5.7
type ResumeError struct {
ScanUUID string
// Kind is the stable error code (Code).
Kind apicontract.ErrorCode
Message string
Diffs []ResumeDiff
}
ResumeError refuses a --resume-scan before anything is built: no session login, OAST registration or request happens for a resume that cannot proceed. Code is scan_not_found (no such scan in this project) or resume_mismatch (Diffs names what differs; --force resumes anyway).
func (*ResumeError) Code ¶ added in v0.5.7
func (e *ResumeError) Code() apicontract.ErrorCode
Code is the stable error code the CLI reports.
func (*ResumeError) Error ¶ added in v0.5.7
func (e *ResumeError) Error() string
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner is a client for running the enumeration process.
func NewWithInputSource ¶
NewWithInputSource creates a new Runner with a custom InputSource. Used by server mode to provide queue-based input.
func (*Runner) Close ¶
func (r *Runner) Close()
Close cancels the run, waits (bounded) for RunNativeScan to finish, then releases resources. Safe to call concurrently and repeatedly — a stop handler and the background-completion path can both call it, so the resource release (which decrements the process-global network dialer refcount) is guarded by sync.Once to avoid a double teardown of the shared dialer.
func (*Runner) Completion ¶ added in v0.5.2
func (r *Runner) Completion() database.ScanCompletion
Completion is the scan-level verdict: whether every phase covered what it was given, and if not, the one reason worth reporting.
"complete" is deliberately hard to earn. Every phase must have ended completed or been skipped for having nothing to do, and no phase may have set a stop reason. Anything else is "partial", including a phase that failed — a scan that lost a phase is not a complete scan, whatever the remaining phases managed.
func (*Runner) Discard ¶
func (r *Runner) Discard()
Discard releases a runner's resources without waiting for RunNativeScan. Used when a scan is rejected (queue full / project busy) before it ever starts: r.done is never closed in that case, so a normal Close would block for the full shutdown timeout. Shares closeOnce with Close so the network refcount is released exactly once.
func (*Runner) Finalized ¶
Finalized reports whether RunNativeScan already wrote the scan's terminal status. The API server uses this so its safety-net CompleteScan only runs when the runner never reached its finalizer (e.g. infrastructure setup failed), avoiding a second write that would clobber the runner's truthful outcome.
func (*Runner) Hurry ¶ added in v0.5.7
func (r *Runner) Hurry()
Hurry drops the runner's shutdown graces: a Close in progress (or a later one) stops waiting for RunNativeScan to unwind. The second Ctrl-C calls it so the findings already stored can be exported within a short deadline instead of after the full shutdown timeout. Idempotent.
func (*Runner) LiveProgress ¶ added in v0.5.7
func (r *Runner) LiveProgress() (phase string, progress *SessionProgress, findings int64)
LiveProgress reports the running phase, its work-item progress (nil when the phase has no count) and the findings it recorded so far. phase is "" between phases. For the CLI's foreground progress line.
func (*Runner) ModuleErrors ¶ added in v0.5.3
ModuleErrors returns the running scan's per-module error totals.
func (*Runner) ModuleStats ¶ added in v0.5.7
func (r *Runner) ModuleStats() map[string]database.ModuleStat
ModuleStats returns the running scan's module ledger (database.ModuleStat per module id), nil when no module ran.
func (*Runner) Pause ¶
func (r *Runner) Pause()
Pause stops dispatch and task admission and returns at once (it never waits for in-flight work); see PauseState for when the pause has taken hold.
func (*Runner) PauseState ¶ added in v0.5.7
PauseState reports "running", "pausing" (pause requested, a worker is still finishing its current item's dispatch) or "paused" (quiesced). Pause itself returns at once; callers that display state use this to tell the two apart.
func (*Runner) Resume ¶
func (r *Runner) Resume()
Resume unblocks paused workers and continues scan processing.
func (*Runner) RunNativeScan ¶
RunNativeScan orchestrates the native scan plan:
HeuristicsCheck — optional root-page probe to optimize downstream phase selection ExternalHarvest — harvest URLs from external intelligence sources (opt-in) HarvestProbe — drop dead/404 harvested URLs before a later phase scans them Spidering — browser-based crawling (opt-in) Discovery — ingest all input + deparos content discovery into DB (no modules) Seed — ingest CLI targets when discovery is skipped but DB-backed phases still need records ParamMining — discover hidden parameters on recorded endpoints (deep / --param-mining) KnownIssueScan — nuclei + secret scan (opt-in via --known-issue-scan) DynamicAssessment — modules + extensions scan DB records
func (*Runner) ScanLogger ¶
func (r *Runner) ScanLogger() *database.ScanLogger
ScanLogger returns the scan logger (may be nil if no repository is set).
func (*Runner) SetRepository ¶
func (r *Runner) SetRepository(repo *database.Repository)
SetRepository sets the database repository for storing scan results
func (*Runner) SetSettings ¶
SetSettings sets the configuration settings for notifications and other YAML-based config
VIGOLIUM_RATE_CEILING is applied to s's scanning_pace here, the one place a runner receives settings.
func (*Runner) StopRequestedBy ¶ added in v0.5.7
StopRequestedBy names who asked this run to stop ("" when nobody did).
type SessionProgress ¶ added in v0.5.3
type SessionProgress struct {
Done int64 `json:"done"`
Total *int64 `json:"total,omitempty"`
Unit string `json:"unit,omitempty"`
}
SessionProgress is the running phase's work-item progress, the same figures phase.progress carries: Total is a non-decreasing upper bound and is nil until one is known.
type SessionStatus ¶ added in v0.5.3
type SessionStatus struct {
ScanUUID string `json:"scan_uuid"`
PID int `json:"pid"`
Host string `json:"host"`
DBPath string `json:"db_path,omitempty"`
ProjectUUID string `json:"project_uuid,omitempty"`
// Status is "running" while the heartbeat runs, then the terminal status.
Status string `json:"status"`
Phase string `json:"phase,omitempty"`
PhaseStartedAt *time.Time `json:"phase_started_at,omitempty"`
PhasesPlanned []string `json:"phases_planned,omitempty"`
PhasesDone []string `json:"phases_done"`
RequestsSent int64 `json:"requests_sent"`
Findings int64 `json:"findings"`
FindingsBySeverity map[string]int64 `json:"findings_by_severity,omitempty"`
Progress *SessionProgress `json:"progress,omitempty"`
StartedAt time.Time `json:"started_at"`
HeartbeatAt time.Time `json:"heartbeat_at"`
// ScanMaxDurationMS is the --scanning-max-duration budget, 0 when unset —
// the one bound a reader can turn into an honest ETA ceiling.
ScanMaxDurationMS int64 `json:"scan_max_duration_ms,omitempty"`
}
SessionStatus is the document a running scan keeps in status.json.
It exists because the scan row cannot always answer "is this scan alive, and how far along is it": under -S and --db-isolate the row lives in a scratch database nobody else can see until the run ends, and the row has no place for work-item progress at all. The file is on the local filesystem of the host that runs the scan, written atomically (a reader sees the previous complete document or the next one, never a torn write), and small enough to rewrite every beat.
func ReadSessionStatus ¶ added in v0.5.3
func ReadSessionStatus(path string) (*SessionStatus, error)
ReadSessionStatus parses a status.json. A missing file is (nil, nil): most readers treat "no heartbeat file" as one absent signal among several.
type StopRequest ¶ added in v0.5.7
StopRequest is the content of a stop sentinel.
type StrategyRequest ¶ added in v0.5.3
type StrategyRequest struct {
// Name selects the strategy; "" falls back to scanning_strategy.default_strategy.
Name string
// HeuristicsCheck is a request-level heuristics level; "" falls back to
// scanning_strategy.heuristics_check, then "basic".
HeuristicsCheck string
// SkipHeuristics forces the heuristics level to "none" (--skip-heuristics).
SkipHeuristics bool
Explicit ExplicitPace
}
StrategyRequest is the strategy half of a scan request.
type TargetAdmission ¶ added in v0.5.3
type TargetAdmission = types.TargetAdmission
TargetAdmission and TargetVerdict are aliased from pkg/types so callers that already import the runner need not import types for them.
func AdmitTargets ¶ added in v0.5.3
func AdmitTargets(scope config.ScopeConfig, targets []string) TargetAdmission
AdmitTargets evaluates every CLI target against scope before any request is sent, and says which ones the scan will actually reach.
The matcher is built exactly as the runner builds the one the executor enforces — config.NewScopeMatcher(scope, targets...) over the full target list — so origin mode is computed over the same index and the verdict here is the one sendItem will apply. Each target is checked as the requester sends it (config.ScopeMatcher.RejectTarget): its port (the scheme's default when the URL names none), the hostname without port, the request-target (path plus query, "/" when empty), and the address rules an IP-literal or instance-metadata host is judged on without resolving it.
Exported so pkg/cli can call it before the runner exists. A target that does not parse as a URL is admitted: scope cannot evaluate it, and refusing it here would hide the real (input) error behind a scope one.
type TargetVerdict ¶ added in v0.5.3
type TargetVerdict = types.TargetVerdict
TargetAdmission and TargetVerdict are aliased from pkg/types so callers that already import the runner need not import types for them.
type TargetsRejectedError ¶ added in v0.5.3
type TargetsRejectedError struct {
Admission TargetAdmission
}
TargetsRejectedError is the typed form of ErrNoTargetsInScope, carrying the admission that refused every target, so a caller can name each target and the rule that refused it.
func (*TargetsRejectedError) Error ¶ added in v0.5.3
func (e *TargetsRejectedError) Error() string
func (*TargetsRejectedError) Unwrap ¶ added in v0.5.3
func (e *TargetsRejectedError) Unwrap() error
type TargetsUnreachableError ¶ added in v0.5.3
type TargetsUnreachableError struct {
// Unreachable names each admitted target and its transport error class.
Unreachable []database.TargetIssue
// Hint is an extra remediation clause (e.g. the scheme was assumed), or "".
Hint string
}
TargetsUnreachableError is the typed form of ErrNoTargetsReachable.
func (*TargetsUnreachableError) Error ¶ added in v0.5.3
func (e *TargetsUnreachableError) Error() string
func (*TargetsUnreachableError) Unwrap ¶ added in v0.5.3
func (e *TargetsUnreachableError) Unwrap() error
Source Files
¶
- admission.go
- auth_wall.go
- banner_pace.go
- browser_policy.go
- browser_session_file.go
- da_write_gate.go
- direct_reasons.go
- extension_failures.go
- extension_llm.go
- finding_grouper.go
- harvest_prefetch.go
- heuristics.go
- host_quarantine.go
- kis_targeting.go
- launch.go
- liveness.go
- module_errors.go
- module_selection.go
- module_tiers.go
- native_plan.go
- oast_mode.go
- parallel.go
- phase_errors.go
- phase_outcome.go
- plan.go
- plan_estimate.go
- port_sweep.go
- preflight.go
- probe_defaults.go
- probe_scheme.go
- request_budget.go
- respider_eval.go
- resume.go
- route_seeds.go
- run_records.go
- runner.go
- runner_browser_auth.go
- runner_dast_tiers.go
- runner_events.go
- runner_infra.go
- runner_live_sessions.go
- runner_modules.go
- runner_output.go
- runner_phase_dast.go
- runner_phase_discovery.go
- runner_phase_fingerprint.go
- runner_phase_harvest.go
- runner_phase_harvest_probe.go
- runner_phase_kis.go
- runner_phase_param_mining.go
- runner_phase_probe.go
- runner_phase_probe_favicon.go
- runner_phase_respider.go
- runner_phase_seed.go
- runner_phase_spidering.go
- runner_phases.go
- runner_secrets.go
- runner_sessions.go
- runner_targets.go
- runner_tech_seed.go
- safe_preset.go
- secret_coverage.go
- setup_deps.go
- spider_fanout.go
- spider_sink.go
- stop_request.go
- strategy_apply.go
- tee_writer.go
- writer_outcome.go