---
title: "AI-Generated Code Security Risks: What Qodana Found in a Java App"
description: "AI-generated code can pass functional tests while containing security vulnerabilities. Qodana’s static analysis of a Java app from the RealVuln Benchmark found 65 findings across 21 files, including a vulnerable XStream 1.4.7 dependency parsing untrusted XML from a cookie, a hardcoded fallback key in Spring configuration that could silently use a credential, and a transitive license policy issue with Hibernate. The XStream deserialization call takes input from a browser cookie without type allowlisting, potentially allowing unintended object instantiation. The hardcoded fallback in the legacy report bridge’s intake key would be used if the environment variable is missing, exposing a credential in source control. Each finding requires human review to assess reachability, production configuration, and appropriate fix, as static analysis provides starting points but not definitive exploitability."
---

# AI-Generated Code Security Risks: What Qodana Found in a Java App

[Jetbrains](https://yomu.fyi/company/jetbrains) · Efim Samoylov · Nov 17, 2026

**Type:** Explainer

## Summary

AI-generated code can pass functional tests while containing security vulnerabilities. Qodana’s static analysis of a Java app from the RealVuln Benchmark found 65 findings across 21 files, including a vulnerable XStream 1.4.7 dependency parsing untrusted XML from a cookie, a hardcoded fallback key in Spring configuration that could silently use a credential, and a transitive license policy issue with Hibernate. The XStream deserialization call takes input from a browser cookie without type allowlisting, potentially allowing unintended object instantiation. The hardcoded fallback in the legacy report bridge’s intake key would be used if the environment variable is missing, exposing a credential in source control. Each finding requires human review to assess reachability, production configuration, and appropriate fix, as static analysis provides starting points but not definitive exploitability.

## Context

The post examines a Java app from the RealVuln Benchmark, seeded with vulnerabilities, to demonstrate how Qodana’s static analysis findings (dependency alerts, taint analysis, hardcoded passwords, license checks) can guide security review of AI-generated code. It emphasizes that static analysis provides starting points but needs human context to determine exploitability.

## Approach / What changed

The post describes running a focused Qodana scan on the Corporate Payments Portal (Java 21, Spring Boot) from the RealVuln Benchmark, then walking through specific findings: a vulnerable XStream 1.4.7 dependency parsing untrusted XML from a cookie, a hardcoded fallback key in Spring configuration, and a transitive license policy issue with Hibernate. It explains how each finding raises a review question about reachability, production configuration, and appropriate fix.

## Takeaways

- Static analysis can surface AI-generated code security risks like vulnerable dependencies, hardcoded values, and data flow issues, but each finding needs human context to determine exploitability.
- A hardcoded fallback in configuration (e.g., Spring placeholder with default) can silently use a credential stored in source control if the environment variable is missing.
- License policy findings from static analysis (e.g., transitive dependency with prohibited license) require review of project policy and distribution model, not just security.

## FAQ

### Is AI-generated code more vulnerable than human-written code?

There is no universal answer. Results depend on the tool, task, application context, and review process. This deliberately vulnerable benchmark cannot establish a comparative rate.

### Can static analysis detect every security issue in AI-generated code?

No. It can identify supported patterns and trace some data flows, but it can miss application-specific authorization rules and runtime behavior. Combine it with human review and targeted testing.

### Can Qodana automatically secure AI-generated code?

Qodana can automate supported inspections and surface findings for triage. It cannot determine whether every flagged path is exploitable or whether the application's security requirements are complete.

**Tags:** [AI](https://yomu.fyi/topic/ai), [Java](https://yomu.fyi/topic/java), [Qodana](https://yomu.fyi/topic/qodana), [Security](https://yomu.fyi/topic/security), [Static Analysis](https://yomu.fyi/topic/static-analysis)

- Source: [Jetbrains](https://blog.jetbrains.com/qodana/2026/11/ai-generated-code-security-risks)
- Source URL: https://blog.jetbrains.com/qodana/2026/11/ai-generated-code-security-risks
- Ingested by Yomu: 2026-11-17T15:00:13.860Z

[Read original post](https://blog.jetbrains.com/qodana/2026/11/ai-generated-code-security-risks)
