Java applications commonly interact with databases to retrieve, insert, update, and delete application data. These operations frequently use SQL queries to process user input, application parameters, and database records.
SQL Injection is a security vulnerability that can occur when untrusted input is incorporated into an SQL query without appropriate handling. If an application constructs SQL statements through unsafe string concatenation, an attacker may influence the query's structure and potentially access or modify data without authorization.
Static Application Security Testing (SAST) tools, such as SpotBugs with FindSecBugs, can analyze Java source code or compiled application code to identify potential security weaknesses. However, a static-analysis finding does not always mean that a vulnerability is exploitable. Some findings may be false positives, while other findings require additional analysis to determine their actual security impact.
In this use case, OWASP Benchmark for Java is used as the target application for evaluating SQL Injection-related security findings. SpotBugs and FindSecBugs are used to identify potential SQL Injection weaknesses through static analysis.
A CodeT5+ model is incorporated into the analysis workflow to examine relevant Java code, SQL query construction, user-input handling, and static-analysis findings. The model assists in classifying findings as potential vulnerabilities, false positives, or findings that require further validation.
Python is used to process the static-analysis results, prepare the information required by the model, evaluate classification performance, and organize the results for presentation through a dashboard. The dashboard presents the detected findings, model-assisted classifications, validation status, and remediation recommendations.
Controlled SQL Injection test cases are evaluated within the authorized OWASP Benchmark for Java environment. The results are compared against the expected vulnerability status to assess whether the model can help reduce false-positive findings without incorrectly dismissing genuine vulnerabilities.
For findings confirmed as vulnerable, secure query remediation recommendations are generated using parameterized queries and appropriate input-handling practices. The application is then reassessed to determine whether the identified weaknesses have been addressed.
Publicly available labeled data is used to support model evaluation and classification assessment. The data is processed for the experiment rather than being treated as proof that every new application finding is exploitable.
The complete security-validation workflow is:
OWASP Benchmark for Java
→
Java Code Analysis
→
SpotBugs and FindSecBugs
→
SQL Injection Findings
→
CodeT5+ Classification
→
False-Positive Assessment
→
Controlled Vulnerability Validation
→
Secure Query Remediation
→
Post-Remediation Testing
→
Python Dashboard
→
Security Evaluation