Cap explicit Spring AI total tool-call budgets (OWASP LLM10)

Proprietary

Reduce explicit maxTotalToolCalls integer literals above the selected ceiling and replace unlimitedTotalToolCalls() with maxTotalToolCalls(ceiling) on DefaultToolCallingManager builders. Preserve smaller limits, dynamic expressions, constants, per-tool limits/exemptions, missing settings, and on-limit behavior. Counts individual tool calls within a turn, not model round trips. Does not bound request volume or time, and does not infer missing limits. Requires the resolved Spring AI budget APIs; older APIs are not rewritten.

org.openrewrite.ai.security.LimitSpringAiToolCalls

Required

A positive application-selected ceiling on individual tool executions across all tools within a Spring AI turn. Reduces larger literal totals and replaces explicit unlimitedTotalToolCalls calls. This can interrupt workflows that need more calls.

mod run . --recipe=org.openrewrite.ai.security.LimitSpringAiToolCalls \ -P maximumToolCalls=20

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.