Skip to content

Workflows and Headless Templates

Two corners of the collection go beyond "send a request, test the answer." Both are surveyed here at the depth the lab could honestly reach — one of them run for real, the other read and counted but not run, for a reason stated plainly when we get to it.

Workflows: checks that gate checks

A workflow is a template whose steps are other templates, with conditions: run this one; if it matches, run those. The shape exists because some questions are only worth asking after another is answered — there is no point running a product's fifty specific checks against a server that isn't running the product. The installed collection holds 207 workflow files, most of them built exactly that way: a technology detection first, the technology's own template family behind it.

The lab's workflow is the smallest useful example. It asks the banner question first and only bothers with the appliance check if the banner matched (examples/lab-workflow.yaml):

id: lab-workflow

info:
  name: Lab Workflow - Banner First, Then the Appliance Check
  author: mere-mortals-lab
  severity: info
  tags: lab,workflow

workflows:
  - template: lab-server-banner.yaml
    subtemplates:
      - template: lab-appliance-detect.yaml

Run it with -w, from the folder holding the templates — a lesson the lab learned twice before it learned it once: the workflow's template names are resolved against the folder you run from (and the default template directory), not against the workflow file's own location, and a name that doesn't resolve is an error line and a workflow that quietly does nothing.

$ cd examples
$ nuclei -duc -nc -ni -w lab-workflow.yaml -u http://127.0.0.1:18084
[INF] Workflows loaded for current scan: 1
[lab-appliance-detect:appliance_banner] [http] [info] http://127.0.0.1:18084/ ["LabWidget/2.1 (lab fixture)"]
[INF] Scan completed in 3.771763ms. 1 matches found.

Read the result carefully: the banner template matched (it had to, or nothing else would have run) but printed nothing — in a workflow, the first template is a gate, not a finding, and only the subtemplates report. Against the tidy fixture, whose banner no longer carries a version, the gate never opens and the run is the now-familiar No results found — the subtemplate wasn't refuted; it was never asked. That distinction is the thing to remember when a workflow's silence lands on your desk: find out whether the gate or the guarded check is the quiet one.

One placement note, verified in passing: a workflow file sitting in a folder you pass with -t is ignored by ordinary scans (the lab's folder held one throughout chapter 3, and scans still loaded exactly three templates). Workflows run when named with -w, and only then.

Headless templates: a browser does the asking — (documented)

Some questions can't be judged from raw HTML: whether a script actually executes, what a page builds in a real DOM, how it behaves after clicks. Headless templates answer those by driving an actual Chrome/Chromium browser — navigating, waiting, interacting — with the matchers judging what the browser saw. The collection holds 24 of them, and the engine's help lists their own concurrency and page-timeout knobs.

This section is documented, not run: the build machine has no Chrome or Chromium installed (checked), and installing a browser to test 24 templates was beyond this guide's lab. What can be said from the templates themselves: they are ordinary YAML with an extra vocabulary of browser steps, they cost far more time per target than request templates (a browser starts, a page loads), and they are the right tool precisely when the check is about behaviour rather than content. If your work needs them, the engine's -headless flag and a locally installed Chrome are the starting point, and every habit from the earlier chapters — narrow selection, known-answer targets, polite rates — applies with interest.