> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/es/web/business-logic/insufficient-workflow-validation.md).

# Validación de flujo de trabajo insuficiente

### Validación insuficiente del flujo de trabajo

**Descripción del laboratorio**

Este laboratorio se basa en suposiciones incorrectas sobre la secuencia lógica de las etapas del proceso de compra. La aplicación no verifica correctamente que se hayan cumplido todas las condiciones necesarias (incluido el pago real) antes de validar un pedido.

\*\* Objetivo:\*\*/ Usa este fallo para comprar el producto \*\*

**Credenciales proporcionadas:**

* Usuario: `wiener`
* Contraseña: `peter`

**Análisis del comportamiento de la aplicación**

* Cuando un usuario intenta pagar un artículo sin crédito suficiente, la aplicación devuelve el siguiente error:

  ```bash
  ?err=INSUFFICIENT_FUNDS
  No hay suficiente crédito de la tienda para esta compra
  ```

<figure><img src="/files/758674717d15687b9f001c9c17862b2630ed7211" alt=""><figcaption></figcaption></figure>

Sin embargo, la confirmación del pedido se basa solo en el acceso a la siguiente URL:

```bash
/cart/order-confirmation?order-confirmed=true
```

* Esta página no comprueba si el pago se realizó realmente o si el saldo era suficiente.

<figure><img src="/files/60e70e073936e1f767e5bfee56ff0678ec25d4f8" alt=""><figcaption></figcaption></figure>

**Funcionamiento del fallo**

1. Añade al carrito un artículo con un precio de **1337 €** (p. ej., la chaqueta objetivo).

<figure><img src="/files/c77164eff73067871eba562bc1b718cd52316c66" alt=""><figcaption></figcaption></figure>

No completes el pago de forma normal (lo que falla por falta de crédito).

Accede directamente, mediante una **GET** solicitud, a la siguiente URL:

`/cart/order-confirmation?order-confirmed=true`

* La aplicación valida entonces el comando sin realizar un control adicional.

<figure><img src="/files/74569b0ad54017f27e7180608d08ac7eab58f333" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/es/web/business-logic/insufficient-workflow-validation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
