TL;DR: Poor code structure, weak validation, and tight coupling create the same conditions that later become exploitable vulnerabilities, according to Sonar. The post argues that treating quality and security as a single governance problem reduces attack surface earlier, especially when AI-generated code increases volume faster than review can keep up.
NHIMG editorial — based on content published by Sonar: how code quality failures become security vulnerabilities
By the numbers:
- 72% of organisations have experienced or suspect they have experienced a breach of non-human identities, with 46% confirmed and 26% suspected.
Questions worth separating out
Q: How should security teams stop insecure code from reaching production?
A: Security teams should enforce policy at merge and build time, not only after release.
Q: Why do code quality problems increase security risk in real codebases?
A: Because brittle, duplicated, or overly complex code is harder to change safely, which increases the chance that security controls will be implemented badly or bypassed during rushed fixes.
Q: How do security teams know whether their control assessment process is working?
A: A working assessment process produces current documentation, clear remediation ownership, timely closure evidence, and results that match what the environment actually shows.
Practitioner guidance
- Enforce security quality gates on new code Block merge or deployment when high-risk findings remain unresolved, especially for unsafe input handling, hard-coded secrets, and taint-flow issues.
- Review AI-generated code with the same policy as human code Apply identical scan, review, and approval rules to AI-assisted changes so code volume does not outrun security oversight.
- Prioritise taint-flow analysis for exposed paths Focus deeper review on code paths that connect user input to database queries, command execution, or file operations.
What's in the full article
Sonar's full article covers the operational detail this post intentionally leaves for the source:
- Walkthrough of how SonarQube for IDE flags risky code patterns at the point of writing.
- Examples of AI CodeFix guidance for remediating specific defects in connected mode.
- Details of the quality gate behaviour that blocks non-compliant code from merge or deployment.
- Reporting views that show mean time to remediate and portfolio-wide code health trends.
👉 Read Sonar's analysis of how code quality defects become security vulnerabilities →
Code quality and security debt: what developers are missing?
Explore further
Code quality is now a security control, not a separate engineering concern. The article is right to frame brittle validation, poor error handling, and excessive complexity as preconditions for exploitation. In governance terms, that means software assurance needs to be judged on whether risky code can reach production, not only on whether a scanner found it. For teams running application security and IAM together, the practical conclusion is to align secure coding enforcement with access to release pipelines.
A question worth separating out:
Q: What should organisations do when AI tools increase code volume faster than review capacity?
A: They should assume manual review alone will miss defects and move enforcement into automated controls. That means scanning AI-generated and human-written code with the same standards, using quality gates, and requiring traceability for every change. The goal is to make review scalable enough that speed does not erase control.
👉 Read our full editorial: Code quality failures are becoming security vulnerabilities in software