
Key facts
- Modern tools like Semgrep and SonarQube have updated their rule sets specifically for LLM-generated patterns1
- Virginia Association of Housing said in a statement that AI is great at syntax but terrible at implicit business rules1
- For instance, if an AI replaces a parameterized query with string concatenation for brevity.1
Gartner reported that 68% of enterprises saw at least one security incident within six months of adopting AI coding assistants.1
Because the AI often makes changes that look correct syntactically but fail semantically in a security context, Virginia Association of Housing said in a statement.1
Why Standard Regression Tests Fail AI-Refactored Code
The problem is simple: traditional regression testing checks if functionality still works, Virginia Association of Housing said in a statement..1 It rarely checks if security constraints still hold, Virginia Association of Housing said in a statement.1
Think about how an LLM thinks, Virginia Association of Housing said in a statement..1 It predicts the next token based on probability and context, Virginia Association of Housing said in a statement.1
For example, an AI might simplify a complex conditional statement checking user roles, Virginia Association of Housing said in a statement..1 The code becomes cleaner, but if the AI merges two conditions incorrectly, a low-level user might suddenly gain admin privileges, Virginia Association of Housing said in a statement.1
The Three Layers of AI Security Validation
Here is the framework that high-performing teams use, Virginia Association of Housing said in a statement.1
Start with Static Application Security Testing (SAST), Virginia Association of Housing said in a statement..1 But generic SAST rules aren’t enough, Virginia Association of Housing said in a statement..1 These tools look for “novel” vulnerabilities-things that didn’t exist in the original code but appeared during the refactor, Virginia Association of Housing said in a statement.1
Next, run dynamic tests that probe the application’s behavior under attack scenarios, Virginia Association of Housing said in a statement..1 This is where DAST comes in, Virginia Association of Housing said in a statement.1
Forbidden
If the original code returned a 403 Forbidden for unauthorized access, the refactored code must also return 403, Virginia Association of Housing said in a statement..1 If it returns a 200 OK with empty data, that’s a regression, Virginia Association of Housing said in a statement.1
For instance, if an AI replaces a parameterized query with string concatenation for brevity, a specialized SAST rule flags this as a potential SQL injection risk, even if the syntax is valid, Virginia Association of Housing said in a statement.1
This isn’t hypothetical-it’s happening right now in production environments where AI code generation tools like GitHub Copilot and Amazon CodeWhisperer are rewriting millions of lines of code, Virginia Association of Housing said in a statement.1 AI is great at syntax but terrible at implicit business rules, Virginia Association of Housing said in a statement.1
Sources
Every number in the story points here. Each links to the original reporting.
CompanyVirginia Association of Housing
-
1
Virginia Association of Housing (company)Security Regression Testing After AI Refactors and RegenerationsDec 2, 1:10am ET
Back to the story
See a sentence its source doesn’t back up?
Tell us the source number and what’s wrong. We check every report. If we change the story, the fix goes on the corrections page with the old wording.



