AI Code Review vs Security Review: Why You Need Both
Quick answer: Review generated code for functional correctness, maintainability, and security. These concerns overlap, but a review focused on expected behavior can miss abuse cases. Combine code inspection with access-control tests, secret checks, and deployment review, and investigate findings before release.
By Paula C · Kraftwire Software
· 11 min readReview generated code for functional correctness, maintainability, and security. These concerns overlap, but a review focused on expected behavior can miss abuse cases. Combine code inspection with access-control tests, secret checks, and deployment review, and investigate findings before release.
What Is the Difference Between a Code Review and a Security Review?
Before shipping an AI-built application, review both intended behavior and potential abuse. A code review can address security, but its coverage depends on the reviewer, available context, and checks performed.
A functional review asks: Does this code behave as intended? For a Lovable dashboard, that can include checking chart rendering and button actions. Code inspection can also cover maintainability and security.
A security review asks: How could this application be abused? It needs to understand legitimate behavior and permissions as well as unexpected inputs and malicious actions.
Review code from Bolt.new, Cursor, Windsurf, and Replit against the application’s intended permissions and deployment environment. Do not infer security from a working demonstration.
These live figures describe all scanned sites. They do not establish prevalence for an AI-built subgroup, compare development methods, or attribute findings to AI generation.
30% of the 119 live sites SimplyScan has scanned (36 sites) have at least one high or critical security issue.
Functional code is not automatically secure code.
What Does AI Code Review Catch?
AI-assisted review can suggest issues in code, but its coverage varies with the tool and context. Treat suggestions as inputs to verification rather than proof of correctness. Examples to inspect include:
Functional Correctness
- Logic errors: Check for incorrect branches and loops that may not terminate.
- Off-by-one errors: Test array and pagination boundaries.
- Type mismatches: Review TypeScript types and runtime handling of
nullorundefined. - Race conditions: Test async operations that may resolve in an unexpected order.
Code Quality and Maintainability
- Refactoring: Inspect duplicated code for appropriate reuse.
- Naming conventions: Replace an unclear name such as
data1with a meaningful name such asuserProfilewhere it describes the value. - Performance: Investigate repeated database queries and unnecessary React re-renders.
Framework Use and Documentation
- Framework patterns: Check Next.js and React code against the versions the application uses.
- Documentation: Verify that comments explain the actual behavior and assumptions.
Functional testing checks specified behavior for the cases exercised. Review test quality and omitted cases rather than treating a passing suite as a complete result.
AI review can identify some security issues and miss others. Inspect hapi.js input handling, authorization, and database query construction directly; a successful request does not establish that hostile input is handled safely.
What Does a Security Review Catch?
A security review examines assets, permissions, trust boundaries, and abuse cases. It combines implementation review with appropriate tests; see the application security audit checklist.
Authentication & Access Control
- Bypassing Login: Can unauthenticated users access
/adminor internal API routes? - Privilege Escalation: Can a "viewer" role change their own permissions to "admin"?
- Broken Auth: Are session tokens stored in
localStoragewhere they are vulnerable to XSS?
Data Exposure and API Security
- Exposed Secrets: Are API keys or database credentials visible in the client-side JavaScript bundles? Review generated code and deployment configuration independently of whether the visible features work. See bolt.new security.
- IDOR (Insecure Direct Object Reference): Can User A change the ID in a URL to view User B's private data?
- Mass Assignment: Can a user send extra fields in a POST request to update their "is_admin" status in the database?
Input Handling and Injection
- Cross-Site Scripting (XSS): Can an attacker inject
<script>tags into a comment field that execute in other users' browsers? - SQL/NoSQL Injection: Can specially crafted inputs bypass database filters?
- Code Injection: Can an attacker execute arbitrary commands on your server? See our guide on code injection prevention.
Infrastructure and Configuration
- Security Headers: Review CSP, HSTS, and framing restrictions for their intended browser protections and limitations.
- CORS Policies: Decide which origins should read API responses. A wildcard (
*) can be appropriate for public data; CORS is not authorization. - Supabase RLS: Test table privileges and applicable RLS policies for the
anonrole and other intended roles. Enabled RLS with no applicable policies denies access to subject roles.
Why You Need Both: The "Vibe Coding" Security Gap
Generated and manually written code both need review against explicit security requirements. Test the deployed implementation rather than inferring its properties from the development method.
The "It Works" Trap
Testing a Lovable or v0 app’s buttons and displayed data exercises expected behavior. Also test whether unauthorized users can invoke those actions or read that data.
A feature can behave as intended for legitimate users while allowing unauthorized access. Add negative tests for the permissions and inputs it must reject.
Architecture and Security Findings
Investigate individual findings and their check definitions before interpreting an aggregate category. A category total does not measure the prevalence of a particular access-control flaw.
11% of the 119 live sites SimplyScan has scanned (13 sites) have at least one medium-severity architecture issue, such as a library with a known vulnerability or no rate limiting.
Comparing Coverage Across Common Scenarios
Login Form
- Code Review: Does the user get redirected to the dashboard?
- Security Review: Can I bypass the password check via the API?
Search Bar
- Code Review: Does it return the correct results?
- Security Review: Can I use it to inject a script (XSS)?
User Profile
- Code Review: Can I update my name and email?
- Security Review: Can I update someone else's email?
File Upload
- Functional review: Does the uploaded image display?
- Security review: Can a
.phpor.jsupload be executed or served in a dangerous context? Check storage, serving headers, and authorization.
API Keys
- Code Review: Is the API responding with data?
- Security Review: Is the secret key leaked in the browser console?
How to Implement Both Reviews Efficiently
Define review scope, expected permissions, and test evidence. Assign specialist review where the risks or implementation require it. See the application security assessment checklist.
1. The AI Code Review (The "Does it Work?" Phase)
- Human-in-the-loop: Never merge an AI-generated PR without reading the code. Look for "hallucinated" library functions.
- Edge Case Testing: Ask the AI to write unit tests for the code it just generated. Specifically ask for "malicious" or "empty" input tests.
- Linting: Use strict TypeScript and ESLint rules to catch basic syntax and type errors.
2. Review Security Controls
- Automated Scanning: SimplyScan’s free URL scan checks supported security and speed signals, along with observable compliance signals. It takes about 30 seconds and requires no signup; it is not a complete security review.
- Secret Scanning: Inspect
.envfiles, frontend bundles, and repositories with supported secret checks. Investigate findings and revoke exposed credentials. - Access Tests: Test logged-out access and cross-user permissions using authorized test accounts and data.
- Database Rules: Review PostgreSQL RLS for Supabase and Firebase Security Rules for the applicable Firebase services. Server credentials can follow different authorization paths.
3. Decide When to Review
Review new features and significant refactors before merging, and test deployed changes. Revisit authentication, authorization, data schemas, and dependencies when they change. Choose recurring review intervals based on the application’s risks.
A Release Review Checklist
Use these checks as part of a review scoped to the application:
No Frontend Secrets
Verify no STRIPE_SECRET_KEY or DATABASE_URL is in the client bundle.
Auth Enforcement
Test authentication and authorization for each sensitive API operation, including resource ownership and roles.
Database Guardrails
For PostgreSQL tables exposed to client roles, review privileges, RLS configuration, applicable policies, and bypass roles. Test expected allow and deny cases.
Input Validation
Validate incoming API data with appropriate schemas and enforce authorization separately. A schema validator does not make database query construction or HTML output safe by itself.
Security Headers
Configure and test Content-Security-Policy for the application. It can limit some script execution paths; it does not replace safe output handling or eliminate XSS.
Domain Health
Review SPF authorization, DKIM signing and validation, and the intended DMARC alignment policy. These controls do not prevent every form of email impersonation.
Compliance Signals
Inspect visible privacy and compliance signals, such as policy links and consent interfaces. Their presence does not establish legal compliance or correct consent behavior.
Why Speed and SEO Matter in Security Reviews
A comprehensive website security audit checklist shouldn't ignore performance.
79% of the 119 live sites SimplyScan has scanned (94 sites) have at least one medium-severity speed issue, such as render-blocking scripts or no route-based code splitting.
While speed is often seen as a UX concern, extreme latency can be a symptom of a Denial of Service (DoS) vulnerability or inefficient database queries that an attacker could exploit to crash your site.
Review metadata and crawler access separately from application security. These checks can reveal observable publishing issues; they do not establish whether an AI search service will index or cite a page.
Summary
Review expected behavior and abuse cases together. Test the actual implementation and deployed settings, and record coverage and unresolved findings. The scan corpus does not establish model priorities or why a finding occurred.
SimplyScan’s URL scan checks observable signals across security, speed, SEO, AEO, accessibility, compliance, domain, and email categories. It usually completes in about 30 seconds. Use the results alongside code review and tests of authenticated behavior.
Run your free security scan now →
FAQ
Can AI coding tools like Cursor or Windsurf replace a security review?
AI suggestions do not replace a review scoped to the application. Inspect generated code, access controls, secret handling, and deployment settings, then test the important allow and deny cases. A working feature is not evidence that those checks have passed.
How long does a security review take for a vibe-coded app?
SimplyScan’s URL scan takes about 30 seconds for supported observable checks. A broader security review depends on application scope, access, and the changes involved. Authenticated authorization tests, code review, and investigation of findings need separate effort.
Which security risk in ai-generated code should I check?
Test access controls and inspect deployed resources for secret credentials. SimplyScan checks recognizable exposed-secret patterns and returned security headers. An anonymous URL scan does not verify authenticated cross-user permissions; test those separately with authorization.
Is passing functional tests enough to ship my app?
No. Passing tests establish results for the cases and assertions exercised. They may omit unauthorized access, hostile inputs, or deployment configuration. Include security requirements in the tests and review gaps in coverage.
Do I need to be a security expert to perform a security review?
You can start with scoped checks, but complex authorization, cryptography, or incident questions may need specialist help. SimplyScan provides supported URL observations such as response-header and exposed-secret checks. Use authorized test accounts and data for manual access-control testing.
Pro Monitoring includes Pro scan credits for full reports. See pricing for the allowance associated with your chosen option.
How often should I run a security review?
Review security-relevant changes before release and test the deployment afterward. Pro Monitoring supports scheduled rescans and change alerts, alongside uptime monitoring. Rescans cover supported observations, including recognizable frontend library versions with known vulnerabilities; they are not a complete dependency inventory.
Frequently asked questions
Can AI coding tools like Cursor or Windsurf replace a security review?
AI suggestions do not replace a review scoped to the application. Inspect generated code, access controls, secret handling, and deployment settings, then test the important allow and deny cases. A working feature is not evidence that those checks have passed.
How long does a security review take for a vibe-coded app?
SimplyScan’s URL scan takes about 30 seconds for supported observable checks. A broader security review depends on application scope, access, and the changes involved. Authenticated authorization tests, code review, and investigation of findings need separate effort.
Which security risk in ai-generated code should I check?
Test access controls and inspect deployed resources for secret credentials. SimplyScan checks recognizable exposed-secret patterns and returned security headers. An anonymous URL scan does not verify authenticated cross-user permissions; test those separately with authorization.
Is passing functional tests enough to ship my app?
No. Passing tests establish results for the cases and assertions exercised. They may omit unauthorized access, hostile inputs, or deployment configuration. Include security requirements in the tests and review gaps in coverage.
Do I need to be a security expert to perform a security review?
You can start with scoped checks, but complex authorization, cryptography, or incident questions may need specialist help. SimplyScan provides supported URL observations such as response-header and exposed-secret checks. Use authorized test accounts and data for manual access-control testing.
How often should I run a security review?
Review security-relevant changes before release and test the deployment afterward. Pro Monitoring supports scheduled rescans and change alerts, alongside uptime monitoring. Rescans cover supported observations, including recognizable frontend library versions with known vulnerabilities; they are not a complete dependency inventory.