--- name: security-business-logic description: Review security invariants in payments, invoices, subscriptions, discounts, refunds, approvals, async jobs, webhooks, and concurrent state transitions. --- # Business workflows and concurrency Read the installed sibling `../web-security-audit/SKILL.md` for boundaries, evidence, and stopping rules. Apply this specialist workflow to the requested scope. For repository-specific context, use the template at `../web-security-audit/assets/context.md`. Reconcile existing context with current code and continue with available repository evidence if no context exists. Draw an explicit transition table before assessing a workflow. For each transition record actor, resource owner, from/to states, authoritative inputs, preconditions, durable write, external side effect, idempotency namespace, and failure recovery. Start with money movement, entitlement grants, identity changes, or irreversible writes. Trace where amounts, currencies, discounts, ownership, and permissions become authoritative. Map asynchronous continuations across workers and provider callbacks. Identify where read/decide/write spans transaction boundaries. Check constraints, conditional updates, locking or version checks, and how a partially completed external operation is reconciled. Compare interactive and scheduled callers, retries, out-of-order events, duplicate delivery, and administrative overrides. Verify that webhook authentication occurs before any effect and that recorded state ties provider events to the right internal principal and resource. Check whether an operation needs separation of duties, step-up authorization, or limits per actor, account, or time period. Bind approvals to the exact resource version and material terms. Review how retry state and reconciliation distinguish a failed local write from an ambiguous external outcome before permitting another effect. For approved fixes, use offline deterministic tests of transition guards, retries, deduplication, duplicate provider notifications through a stub, and transaction rollback behavior. Assert durable state and external side-effect counts. Require explicit approval before changing financial or entitlement contracts. ## Transition and effects table For each critical transition include its allowed actor, concurrency guard, and expected durable writes and external effects. Include a row for an ambiguous provider response and identify the reconciliation evidence needed before retry. Record the failed invariant and affected state when a finding spans multiple callers. Return revision-relative evidence and coverage gaps using the report template at `../web-security-audit/assets/report.md`. Check repair and reconciliation paths for the same authority and accounting invariants as the forward path. Document which state is authoritative when a provider callback, local write and operator decision disagree. Read [the enterprise review guide](references/enterprise-review.md) when a workflow crosses transactions, external providers, approvals or retries.