Skip to main content
A workflow is a small DAG of scanning steps. The workflow engine is the part of the core API that turns that definition into runs: it validates the graph when it is saved, decides when a run starts, and — together with the job registry — decides which step runs next. The workflow file format and its options are documented for users in Workflows. This page explains the machinery behind them.

The definition

A workflow is stored as JSON in the database, authored as YAML. Its jobs are a map keyed by job id; each job names a tool (run), optional inline config, and the ids it needs. Jobs without needs are roots and start together. Every save goes through the same checks, and all errors are returned at once:
  • Graph — every needs id exists and there is no cycle.
  • Tools — each step’s tool category can consume the step’s declared inputs.
  • Reachability — for target-triggered workflows, each step can scan at least one target type that the trigger fires for.
Because JSON objects have no key order, the engine never relies on the order of the jobs map: it orders steps from the graph itself.

Default workflows

Every workspace gets a set of default workflows shipped with the core API as YAML templates — domain discovery, IP address discovery, a basic vulnerability scan, repository scanning and on-demand URL discovery. They are created with the workspace and re-synced on every boot: a template row whose content differs from the shipped file is overwritten. Default workflows are therefore read-only, and an upgrade can improve them without a migration. To customize one, copy it into a project.

Trigger paths

A run can start in five ways. Each has its own plumbing, chosen for the guarantees it needs.

Batch windows

Event triggers do not start one run per event. A discovery that adds 3,000 assets to a project would otherwise start 3,000 runs. Instead, each trigger has a window (windowMinutes, default 10):
  1. The first event opens the window and schedules one delayed job. Later events only add their assets to the pending set in Redis.
  2. When the window closes, the pending assets that are still in the project are split into runs of at most maxAssets (default 200).
  3. The causing runs are recorded on the new runs, so the console can show why a run started.
Adding an asset twice — for example on a redelivered event — adds it once, because the pending set and the project membership are both idempotent.

Loop protection

Project workflows can trigger each other, so the engine guards against loops:
  • A workflow’s own run finishing, or its own findings, never start that workflow again. Only assets it brings into the project can.
  • Every run records its chain depth. An event more than three hops down a chain starts nothing.
  • Archived projects ignore every trigger and their schedulers are removed until the project is reopened.

A run’s scope

A run records its scope when it starts — the assets of a target, or the project assets it was started on — and every step reuses that stored scope. Inputs are looked up when a step starts, not when the run starts, so a later step sees what earlier steps of the same run discovered. A project run never leaves the project’s assets, and it cannot start unless every root tool is installed in the workspace. From there, execution is the job registry’s business: each step fans out into one job per input, workers claim them, and the engine advances the run when a step drains.

Run outcomes

When a run ends, the engine emits an in-process event that several parts of the platform listen to:
  • Statistics diff the target’s inventory against a snapshot taken at the start of a discovery run and publish workflow.run.completed with what the run changed.
  • Projects turn it into project.run.completed, which can start the next workflow of a pipeline.
  • URL discovery publishes asset.url.discovered for on-demand crawls.

Workflows

The workflow file, triggers and data kinds, from the user’s side

Job registry

Claiming, results and advancing a run

Projects

Project pipelines, scope rules and triggers

Event bridge

The bus that carries project events