AG-019: Context Overflow: Multiple Unbounded Data Tools

MEDIUM AG-019 OWASP ASI01 · ASI10

What this rule means

Two or more tools can return unbounded output into the model's context (the rule fires at >=2). Attacker-controlled bulk text can then push the system prompt and safety instructions out of the effective window, and it is a cost and latency problem as well as a security one.

Why it matters

Instructions that fall out of the attended context stop constraining behaviour — flooding the window is the cheapest way to dilute them.

How to fix it

Truncate every tool return to an explicit maximum (`if len(result) > MAX_TOOL_OUTPUT`), and paginate rather than inlining large payloads.

Detect it

pip install lucin
lucin scan .                  # all rules
lucin explain AG-019          # this rule, in your terminal

Findings carry a file:line and, where the rule supports it, a witness path showing the flow that triggered it. Precision and recall for the whole rule set, with the commands that regenerate them, are on the benchmarks page — and the gaps are on limits.

← All detection rules