> 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/pt-br/web/business-logic/insufficient-workflow-validation.md).

# Validação Insuficiente do Fluxo de Trabalho

### Validação de fluxo de trabalho insuficiente

**Descrição do laboratório**

Este laboratório é baseado em suposições incorretas sobre a sequência lógica das etapas do processo de compra. A aplicação não verifica adequadamente se todas as condições necessárias (incluindo o pagamento real) foram atendidas antes de validar um pedido.

\*\* Objetivo:\*\*/ Use esta falha para comprar o produto \*\*

**Credenciais fornecidas:**

* Usuário: `wiener`
* Senha: `peter`

**Análise do comportamento da aplicação**

* Quando um usuário tenta pagar um item sem crédito suficiente, a aplicação retorna o seguinte erro:

  ```bash
  ?err=INSUFFICIENT_FUNDS
  Crédito da loja insuficiente para esta compra
  ```

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

No entanto, a confirmação do pedido é baseada apenas no acesso ao seguinte URL:

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

* Esta página não verifica se o pagamento foi realmente efetuado ou se o saldo era suficiente.

<figure><img src="/files/57681af57c43efa18b846b1afe646a0f3539b86b" alt=""><figcaption></figcaption></figure>

**Funcionamento da falha**

1. Adicione ao carrinho um item com um preço de **1337 €** (por exemplo, a jaqueta alvo).

<figure><img src="/files/6e9dcde45817825294e32915915a1cb9e3cdcf57" alt=""><figcaption></figcaption></figure>

Não conclua o pagamento normalmente (o que falha devido à falta de crédito).

Acesse diretamente, por meio de uma **GET** requisição, a seguinte URL:

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

* A aplicação então valida o comando sem realizar controle adicional.

<figure><img src="/files/ea1e1e431a09b23c9f84dd4c44b7a1f0ba423272" 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/pt-br/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.
