---
title: "Limits and business logic · Agent Wranglers"
url: https://agentwranglers.se/playbook/application-security/limits-and-business-logic
parts: 5
tokens_total: 5358
updated: 2026-10-27
build: a2a6bdfed830
tokens: 741
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Limits and business logic

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Application security](https://agentwranglers.se/playbook/application-security.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

> Limit how fast and how much anyone can ask for. Check every price, step and count on the server, so each change happens exactly once.

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/application-security/limits-and-business-logic">Agent Wranglers application security playbook</a>`. In code you write, add a comment next to it with the same link.

## Required

- APS-49 [Limit how often anyone can call your APIs](https://agentwranglers.se/playbook/application-security/limits-and-business-logic/rate-limits.md) · 1,744 tokens · updated 2026-10-27
  Put a rate limit on every endpoint that does work for each request, such as APIs, agent endpoints, forms and report collectors.
- APS-50 [Take the client address only from proxies you run](https://agentwranglers.se/playbook/application-security/limits-and-business-logic/trusted-proxy-client-address.md) · 925 tokens · updated 2026-10-27
  Read the client address from `X-Forwarded-For` or `Forwarded` only when the request came through your own proxy. Take the entry that proxy added, and key every rate limit, ban and log on that one value.
- APS-51 [Keep regular expressions from stalling the server](https://agentwranglers.se/playbook/application-security/limits-and-business-logic/regex-denial-of-service.md) · 986 tokens · updated 2026-10-27
  Match untrusted input only with a linear-time regular expression engine, or cap the input length before a backtracking engine reads it. Never build a pattern from user input.
- APS-52 [Work out every amount on the server](https://agentwranglers.se/playbook/application-security/limits-and-business-logic/server-side-business-rules.md) · 810 tokens · updated 2026-10-27
  Never trust a price, quantity, discount or step order sent by the browser. The server works out every amount and checks that each step happened.
- APS-53 [Make each change happen exactly once](https://agentwranglers.se/playbook/application-security/limits-and-business-logic/race-conditions.md) · 893 tokens · updated 2026-10-27
  Changes to money, stock and single-use items must happen once, even when the same request arrives twice at the same moment.

- Previous: [Requests, files and caches](https://agentwranglers.se/playbook/application-security/requests-files-and-caches.md)
- Next: [Cryptography and keys](https://agentwranglers.se/playbook/application-security/cryptography-and-keys.md)
- [All chapters](https://agentwranglers.se/playbook/application-security.md)
