Find unrestricted prompt selection (OWASP LLM01)

Proprietary

Find code where untrusted input picks which LLM prompt template runs. Concretely, an HTTP request value — a servlet or Spring WebRequest accessor, or a Spring MVC handler parameter bound with @RequestParam, @PathVariable, @RequestHeader, @RequestBody, @RequestPart, @CookieValue, or @MatrixVariable — flows into a Map.get(...) key argument, and the value returned by that map lookup flows into an LLM prompt sink. This is the OWASP LLM01 shape where an attacker can jailbreak or escalate by switching to a system prompt they shouldn't be able to reach (tenant-prompt escape, admin templates, etc.). Taint tracking follows both legs of the flow through user-defined transformations.

org.openrewrite.ai.security.FindUnrestrictedPromptSelection
mod run . --recipe=org.openrewrite.ai.security.FindUnrestrictedPromptSelection

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