<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: CapsAGI</title>
    <description>The latest articles on DEV Community by CapsAGI (@capsagi).</description>
    <link>https://dev.to/capsagi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4251109%2Fd4b6aa7a-7ad6-4327-83c4-5e21b6704788.png</url>
      <title>DEV Community: CapsAGI</title>
      <link>https://dev.to/capsagi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/capsagi"/>
    <language>en</language>
    <item>
      <title>I reviewed the database policies of 145 AI-built Supabase apps. 16 were wide open.</title>
      <dc:creator>CapsAGI</dc:creator>
      <pubDate>Wed, 18 Nov 2026 06:09:05 +0000</pubDate>
      <link>https://dev.to/capsagi/i-reviewed-the-database-policies-of-145-ai-built-supabase-apps-16-were-wide-open-1h81</link>
      <guid>https://dev.to/capsagi/i-reviewed-the-database-policies-of-145-ai-built-supabase-apps-16-were-wide-open-1h81</guid>
      <description>&lt;p&gt;Over the past week I read through the public code of 145 recently shipped web apps built on Supabase — most of them Next.js, the stack AI coding tools reach for by default. I wasn't running scanners against anyone's servers. I read what the repos themselves publish: migration files, schema dumps, config. No repos are named here, and nothing was probed or tested live.&lt;/p&gt;

&lt;p&gt;16 of the 145 — 11% — had at least one serious, exploitable-by-design problem sitting in plain sight. Here's what they were, because the patterns repeat almost word for word.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pattern 1: The policy that lets everyone in (13 of the 16)
&lt;/h2&gt;

&lt;p&gt;Row Level Security was enabled. The policies existed. They just didn't restrict anything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="no"&gt;POLICY&lt;/span&gt; &lt;span class="s2"&gt;"allow_all"&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
  &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;authenticated&lt;/span&gt;
  &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="k"&gt;CHECK&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Variations I kept seeing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;FOR SELECT USING (true)&lt;/code&gt; on tables holding names, emails, and phone numbers — any signed-in user can read every row.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;INSERT&lt;/code&gt; / &lt;code&gt;UPDATE&lt;/code&gt; policies with &lt;code&gt;WITH CHECK (true)&lt;/code&gt; — any signed-in user can write or modify anyone's data.&lt;/li&gt;
&lt;li&gt;Policies with no &lt;code&gt;TO&lt;/code&gt; clause at all, which means they apply to the anonymous role too — no account needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These weren't edge-case tables. They were orders, customer records, CRM data, loan records, user profiles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pattern 2: Real secrets committed where they don't belong (3 of the 16)
&lt;/h2&gt;

&lt;p&gt;Two were &lt;code&gt;.env.example&lt;/code&gt; files containing values in real secret formats — auth secrets, webhook secrets, cron secrets, a database URL with the password in it. The filename says "example." The contents say otherwise. The third was a hardcoded secret-key default sitting in a config file — harmless only if production remembers to override it. Anything committed to a public repo should be treated as published, whether the filename sounds harmless or not.&lt;/p&gt;

&lt;h2&gt;
  
  
  The interesting zero
&lt;/h2&gt;

&lt;p&gt;I found &lt;strong&gt;zero&lt;/strong&gt; cases of a &lt;code&gt;service_role&lt;/code&gt; key shipped in frontend code in this sample. A year of warnings about that one seems to have landed. The failure mode has moved: the keys are fine now — the policies are the open door.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why AI keeps writing it this way
&lt;/h2&gt;

&lt;p&gt;Watch what happens during an AI-assisted build. A query fails with a permission error. The fastest fix that makes the error go away is a permissive policy. The app works, the demo passes, the policy stays. Nobody in that loop ever asks the follow-up question: &lt;em&gt;who else can read this table now?&lt;/em&gt; The code does exactly what it was optimized to do — stop erroring.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check your own app in five minutes
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Look at your policies.&lt;/strong&gt; In the Supabase dashboard (Table Editor → your table → RLS policies), or in SQL: &lt;code&gt;SELECT policyname, cmd, qual, with_check FROM pg_policies WHERE schemaname = 'public';&lt;/code&gt; — any &lt;code&gt;qual&lt;/code&gt; that is just &lt;code&gt;true&lt;/code&gt; on a user-data table is a finding, not a convenience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test as a stranger.&lt;/strong&gt; Create a second account, sign in as that user, and use your app's own public anon key to select rows from your users/orders table. If you get back other people's data, so can anyone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grep your history.&lt;/strong&gt; Search your repo — including old commits — for &lt;code&gt;SERVICE_ROLE&lt;/code&gt;, &lt;code&gt;SECRET&lt;/code&gt;, and real-looking values in &lt;code&gt;.env*&lt;/code&gt; files. If a real secret ever landed in a public commit, rotate it; deleting the file doesn't unpublish it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;AI builders are very good at making apps that work and noticeably worse at making apps that refuse. If your RLS policies say &lt;code&gt;true&lt;/code&gt;, your database is a public document with extra steps.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Disclosure: I run CapsAGI — fixed-price security checkups for AI-built apps. The checks above are the first things we look for. I also maintain a free, open-source rules pack that teaches Cursor and Claude Code not to write these patterns in the first place: &lt;a href="https://github.com/shisanyue950901-beep/vibe-security-rules" rel="noopener noreferrer"&gt;https://github.com/shisanyue950901-beep/vibe-security-rules&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>supabase</category>
      <category>security</category>
      <category>nextjs</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
