Testing State-Based and Workflow Authorization
What you'll learn: How to verify that authorization checks properly enforce rules at each stage of a multi-step process and prevent users from jumping to unauthorized states.
The Core Problem
Many applications have workflows where actions must happen in order—like drafting a document, submitting it for review, and publishing it. State-based authorization means users should only perform actions appropriate to the current state. For example, you shouldn't be able to approve your own draft or publish without approval.
The analogy: Imagine a package delivery system. You can't mark a package as "delivered" if it's still in "processing" status, and a customer shouldn't be able to change the package state to "out for delivery"—only the courier can. Each role has permissions tied to specific states.
What to Test
State transition validation: Verify users can only move between valid states. Can someone jump from "draft" directly to "published" without going through "review"?
Role-state combinations: Test that users' roles align with allowed actions in each state. Can a regular user approve content when only managers should in the "pending approval" state?
Parameter manipulation: Try forcing state changes by modifying hidden fields, API parameters, or URLs. Send status=approved when the item is in draft mode.
Bypassing steps: Attempt to skip workflow stages entirely—submit actions out of sequence or replay old state values.
Testing Approach
- Map all states and valid transitions in the workflow
- Test each role at each state for both allowed and forbidden actions
- Attempt invalid state transitions through parameter tampering
- Verify server-side validation (not just UI hiding)
- Check if prior states can be replayed or revisited inappropriately
Key Takeaway: State-based authorization testing ensures users can only perform actions valid for the current workflow stage and their role, preventing workflow manipulation and unauthorized state transitions through server-side validation.