Find LLM freeform output flowing into a structured parser (OWASP LLM01)

Proprietary

Find code where the plain-text output of an LLM chat call flows into a structured parser (ObjectMapper.readValue/readTree, Gson.fromJson). Model output is read through the LangChain4j, Spring AI, OpenAI, Anthropic, and Azure AI Inference Java SDKs. The caller expects JSON but nothing enforced structured output on the model call — an attacker who influences the prompt (any LLM01 vector) can break parsing or steer downstream logic by producing content the parser accepts as valid but that carries injected instructions. Fix by switching to a schema-enforcing call: LangChain4j structured output APIs, Spring AI .entity(...), or provider-native JSON mode / tool use. Taint tracking follows the value through user-defined transformations between the model call and the parser.

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

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