TL;DR: AI-generated code can ship exposed applications when security controls such as row-level security, policy coverage, and authentication logic are not enforced in the generation workflow, according to Symbiotic Security. The Lovable case shows why security review after code generation is too late when insecure defaults reach production.
At a glance
What this is: This is an independent analysis of a Lovable app exposure case and the broader risk of AI-generated code shipping with broken access controls.
Why it matters: It matters because IAM, application security, and data teams need governance that catches insecure authentication and authorisation before AI-assisted code reaches production.
By the numbers:
- The incident involved 16 vulnerabilities, including 6 critical issues that enabled data exposure and account abuse.
👉 Read Symbiotic Security's analysis of exposed Lovable apps and AI code security gaps
Context
AI-assisted code generation speeds delivery, but it also compresses the time available for security review and can embed unsafe defaults directly into production code. In this case, the core problem is not AI itself, but the absence of enforced controls around row-level security, authentication, and data access before deployment.
For identity and access practitioners, the important issue is that application logic can become an authorisation control surface. When AI-generated code mishandles RLS or access checks, the result is not just a software bug, but a failure in how human users, service paths, and sensitive records are governed.
Key questions
Q: How should security teams govern AI-generated code in production environments?
A: Security teams should treat AI-generated code as normal production code with extra provenance risk. Require architectural review, test coverage, static analysis, and approval before merge. Then bind the agent and the build pipeline to least privilege, short-lived credentials, and complete audit logging so implementation speed does not outrun control.
Q: What breaks when row-level security is missing in an AI app?
A: Any mistake in the application layer can turn into a data exposure event, because the database has no built-in awareness of tenant, role, or purpose. In RAG systems, that can mean the model is fed content from the wrong access class and generates answers outside entitlement.
Q: How can organisations tell whether AI is creating access risk?
A: Organisations should look for AI systems that can reach production data, security tools, or administrative workflows through persistent credentials. A growing count of service accounts, unclear ownership, or missing rotation evidence usually means the AI programme is expanding identity risk faster than it is controlling it.
Q: Who is accountable when an integration or AI workflow exposes customer data?
A: Accountability should sit with the system owner, the identity owner, and the control owner for the workflow that exposed access. In practice, that means the team responsible for granting and reviewing the credential path must answer for how the exposure happened and how quickly it was contained. Shared platforms do not remove accountability; they make it more explicit.
Technical breakdown
How AI-generated code bypasses row-level security
Row-level security, or RLS, is meant to ensure users only see the records they are allowed to access. In the incident described, the generated application never enabled RLS in Supabase, so the database had no enforced record-level boundary even though the app looked functional. When authentication logic is backwards, the system can block legitimate users while allowing unauthorised access paths to succeed. This is a classic authorisation failure, not just a coding defect. If the access control model is absent or misapplied, downstream features inherit that weakness and expose real data.
Practical implication: treat RLS as a deployment gate, not a code review suggestion.
Why AI code tools struggle with security context
AI code generation is optimised for producing working syntax, not for understanding a programme’s security model. That means it can generate database queries, auth flows, and config files that appear correct while violating security assumptions such as least privilege, authenticated access, and data minimisation. The article’s broader warning is that developers often rely on AI precisely because they are not security specialists, which increases the chance that unsafe logic will be trusted and merged. Security cannot be assumed to emerge from the model itself; it has to be enforced by the workflow around it.
Practical implication: add policy checks and security tests around AI-generated changes before merge.
What config and secret checks need to catch in generated apps
The article notes hardcoded secrets, missing policies, and absent FORCE ROW LEVEL SECURITY as detectable failure modes. These are important because they show the boundary between code generation and operational safety. Secrets in config create immediate compromise paths, while policy gaps create silent overexposure even without a direct exploit. A read-only scanner can surface both the structural misconfigurations and the deployment drift between local code and live databases. That makes configuration validation part of identity and data governance, not just DevSecOps hygiene.
Practical implication: scan both source files and live databases for authorisation drift and embedded secrets.
Threat narrative
Attacker objective: The attacker objective is to turn a publicly exposed AI-built application into a route for data access, account abuse, and mass privacy compromise.
- Entry occurs when an AI-generated application is deployed with insecure database and authentication logic already embedded in the code.
- Escalation follows because missing row-level security and backwards auth checks let unauthorised users reach records and privileged actions.
- Impact is full exposure and abuse of user data, including bulk email sending, account deletion, and viewing sensitive PII.
NHI Mgmt Group analysis
AI code generation has become an authorisation problem, not just a software quality problem. When generated code ships without enforced row-level security, the failure is not cosmetic. It is a governance failure over who can see and do what inside production systems. That shifts responsibility from developer intent to control enforcement, which is where application security and IAM must meet.
Row-level security drift is a named control gap: the policy exists in design but not in execution. This incident shows what happens when security assumptions are left inside prompts, templates, or reviewer memory instead of being validated at runtime. Practitioners should treat RLS drift as a measurable exposure class, because once live data is reachable, the trust boundary has already failed.
AI-assisted development amplifies the gap between secure intent and deployed reality. The problem is not that AI code is always insecure, but that it can scale insecure patterns faster than teams can review them. That makes pre-commit validation, database policy enforcement, and secret detection foundational controls, not optional guardrails.
Application data governance now includes identity governance at the query layer. If an app can expose minors’ data, bulk messaging capabilities, or account deletion functions through broken auth, then identity decisions are being made in code paths as much as in IAM consoles. Teams should align application controls with identity and access governance so the record layer is not treated as a separate problem domain.
What this signals
Row-level security drift is a useful shorthand for what happens when the intended authorisation model never makes it into the deployed database. For IAM and application security teams, the issue is not only access denial but the possibility that AI-generated code creates silent overexposure faster than controls can detect it. Aligning database policy validation with identity governance reduces that gap.
The governance lesson is that AI-assisted development needs the same control discipline as third-party access and workload identity. When the query layer becomes a policy boundary, teams should apply access review, configuration enforcement, and secret management together rather than as separate checks.
If your programme is already tracking credential sprawl and delegated access, treat generated code as another place where trust can be misplaced. The operational question is no longer whether AI can write code, but whether your release process can prove that the code respects the access model before users do.
For practitioners
- Enforce row-level security as a release blocker Require every production database to fail deployment if RLS is enabled without defined policies, if FORCE ROW LEVEL SECURITY is missing, or if access defaults to allow-all behavior.
- Scan live databases, not just source files Run read-only checks against deployed Lovable projects or equivalent AI-built apps to detect policy drift between migration files and the actual database state.
- Add secret detection to AI-assisted pipelines Flag hardcoded secrets in configs, migration scripts, and environment files before merge so generated code cannot move into production with embedded credentials.
- Test authentication flows for reversed logic Include negative tests that prove unauthorised users cannot read records, send emails, or delete accounts even when the UI or generated code suggests they can.
Key takeaways
- AI-generated code can expose production data when row-level security and authentication logic are not enforced before deployment.
- The Lovable case shows a control failure pattern, not a one-off bug: 16 vulnerabilities and 18,000+ users' personal data were exposed.
- Teams need release gates that validate authorisation, secrets, and live database state before AI-assisted code reaches users.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST CSF 2.0 | PR.AC-4 | Authorisation failures and overexposure map directly to access control governance. |
| NIST SP 800-53 Rev 5 | AC-6 | Least privilege is the core control missing when AI code grants broad data access. |
| CIS Controls v8 | CIS-5 , Account Management | The case involves account access, authentication logic, and exposed records. |
| MITRE ATT&CK | TA0006 , Credential Access; TA0009 , Collection; TA0040 , Impact | The incident pattern includes unauthorised access, data collection, and harmful account actions. |
Map generated-code release checks to PR.AC-4 and block deployments that bypass record-level access control.
Key terms
- Row-Level Security: Row-level security is a database control that restricts which rows a session can read or modify based on policy. For multi-tenant apps, it is valuable because it pushes tenant enforcement below application code, reducing the chance that a forgotten filter exposes another organisation's data.
- Authentication bypass: An authentication bypass is a flaw that lets a requester reach protected functionality without completing the intended identity check. In practice, it turns the application’s login boundary into a broken assumption, so any exposure path in front of that application becomes materially more important.
- Scope drift: Scope drift is the gradual mismatch between what an integration was meant to do and what its credentials still allow it to do. It happens when permissions are not revalidated as business needs change, creating hidden over-privilege across SaaS and API-connected systems.
What's in the full analysis
Symbiotic Security's full article covers the operational detail this post intentionally leaves for the source:
- The exact Vibe-Scanner rule categories used to detect insecure RLS and authentication patterns in Lovable projects.
- The read-only scanning workflow for comparing local SQL migrations with the deployed database state.
- The remediation path for teams that discover exposed tables, missing policies, or embedded secrets in generated code.
- The direct steps the vendor recommends for users of AI code platforms that need to harden access controls.
Deepen your knowledge
NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, machine identity security, and secrets management. It helps security and identity practitioners build the controls that keep access decisions enforced as systems change.
Published by the NHIMG editorial team on August 19, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org