Lesson 6 of 9 · 26m
SOAR-Style Workflows Without the Box of Magic
Playbooks are state machines with side effects; model steps, approvals, evidence, and rollback explicitly before letting automation touch production controls.
Commercial SOAR platforms sell the dream of dragging boxes around until incidents resolve themselves. Underneath the graphics, useful response automation is stricter and simpler: a queue of work, explicit states, guarded actions, and evidence written while the workflow runs.
Model the workflow as a state machine
A phishing response is not a function call. It is a sequence of states with branching, waiting, and failure handling.
received -> parsed -> indicators-extracted -> verdict-pending
verdict-pending -> approved -> mailbox-purged -> closed
verdict-pending -> rejected -> analyst-reviewEach transition should be small enough to retry or inspect. Do not write one function that extracts URLs, checks reputation, deletes mail, resets passwords, and closes the case; that function is impossible to debug and dangerous to rerun.
TRANSITIONS = {
"received": parse_message, "parsed": extract_indicators,
"indicators-extracted": score_verdict, "verdict-pending": request_approval,
"approved": purge_mailbox, "rejected": close_as_false_positive,
}The engine reads state, executes the next transition, records output, and updates state. That is the core; everything else is convenience.
Put dangerous actions behind explicit approval
Containment needs policy. Isolating a workstation because a browser crashed is different from isolating a finance host with credential-theft evidence.
def approval_required(action: str, target: dict) -> bool:
if action in {"isolate-host", "disable-user", "block-domain"}:
return True
return target.get("criticality") in {"high", "regulated"}Approval is evidence: who approved, what they saw, which action version ran, and when the approval expires. Include target, reason, blast radius, rollback, and expiration in the approval view.
Write evidence before taking action
The workflow should produce a case file even if the action fails. Capture input hashes, decisions, relevant API responses, and the exact requested action.
{
"case": "PHISH-2026-1181",
"action": "mailbox.purge",
"approval": "alice@sudosecurity.org",
"requested_at": "2026-11-30T21:40:18Z",
"remote_id": "purge-job-9921"
}Expect partial completion. A workflow can disable an account but fail to revoke sessions; track actions independently and reconcile them instead of closing the case because the top-level job reached done.
Field notes
- Use queues for handoffs between detection, enrichment, approval, and action.
- Idempotency keys apply to every action step, not just ticket creation.
- Build an emergency stop; one bad feed should not isolate five hundred endpoints.
- Start read-only, prove decision quality, then add reversible actions.
- Approval without an expiration date becomes permanent risk accumulated one emergency at a time.
Was this lesson helpful?