# Workflow State Machine Testing

Treat multi-step application flows as state machines and abuse them - step skipping...

- Repository: https://github.com/xalgorix/xalgorix (1285 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add xalgorix/xalgorix --skill workflow-state-machine-testing -g -a claude-code -y`
Codex: `npx skills add xalgorix/xalgorix --skill workflow-state-machine-testing -g -a codex -y`
Cursor: `npx skills add xalgorix/xalgorix --skill workflow-state-machine-testing -g -a cursor -y`
Gemini CLI: `npx skills add xalgorix/xalgorix --skill workflow-state-machine-testing -g -a gemini-cli -y`

## Description

Treat multi-step application flows as state machines and abuse them - step skipping, step replay, reverse ordering, cross-session and cross-account token reuse, stale-state replay, and alternate-endpoint state checks across web, mobile, legacy, and GraphQL routes.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Workflow / State-Machine Testing

## Purpose

Registration, verification, password reset, MFA enrollment, checkout, refund, KYC, approval, invite, subscription, file import, moderation, publishing, ticket handling - every multi-step flow is a state machine. Implementations enforce the HAPPY ORDER on the client but frequently trust each server-side step in isolation. This skill systematically abuses the machine: wrong order, repeated steps, borrowed tokens, stale states, alternate endpoints.

## Entry Conditions

- A flow with 2+ sequential steps is identified, where a later step should be unreachable without an earlier one
- Step transitions are observable (tokens, status fields, changed responses, redirected routes)

## Step 1: Map the Machine

For the target flow, record every step as: trigger request, resulting state marker (token, status field, cookie, response shape), and what the NEXT step expects. State markers hide in: URL tokens, hidden form fields, JSON status fields ("verified": false, "stage": 2), session attributes, and client-side route guards in JS bundles (which reveal the EXPECTED rules the backend may not enforce).

## The Six Abuses

### 1. Step skipping

```text
intended:  1 -> 2 -> 3 -> 4
try:       1 -> 4          (and: nothing -> 4)
```
Call the terminal step directly. Examples: access the dashboard with an unverified account; confirm an order without payment; hit the post-MFA landing route after password-only login; grant access without the approval step; publish without moderation.

### 2. Step replay

```text
1 -> 2 -> 3, then replay 3 (or 2) again
```
One-time actions that can repeat: coupon redemption, vote, verification, password reset, refund. Replay the exact captured request of the completed step.

### 3. Reverse ordering

Call step 3 before step 2 (with markers fabricated or borrowed). Servers that check "is the token valid" but not "is the flow in the right stage" accept out-of-order transitions.

The rest: https://github.com/xalgorix/xalgorix/blob/HEAD/internal/tools/skills/data/application-security/workflow-state-machine-testing/SKILL.md
