Same security guide
How to secure a Same.new + Supabase app
Enable RLS on every table Same creates, scope its Supabase MCP connection to a single project, and keep the secret key out of client code. Same builds your schema through MCP from prompts and its docs mention no RLS step or security scan, so check the database yourself with a catalog query and the Supabase Security Advisor before you deploy.
Last updated
How does Same connect to Supabase?
- Open the Tools panel and find the Supabase card.
- Click Add Supabase and authorize. This connects the Supabase MCP server.
- Prompt Same to build. It creates the Supabase project, designs the schema and runs the migrations.
How do I limit what the Supabase MCP connection can do?
Supabase's MCP guide names prompt injection as the main LLM-specific attack. Its advice applies to the connection Same uses.
- Scope the connection to one project, not the whole organization.
- Use read-only mode for any routine that runs without you watching.
- Build against a development project. Connect production only when a task needs it.
How do I find tables Same created without RLS?
Run the query in the Supabase SQL editor after each prompt that changes the schema. Enable RLS and add policies for every table it returns.
-- Tables in public without RLS. This must return no rows.
select c.relname
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where n.nspname = 'public' and c.relkind = 'r' and not c.relrowsecurity;alter table public.posts enable row level security;
create policy "posts: owner reads" on public.posts
for select to authenticated
using ((select auth.uid()) = user_id);
create policy "posts: owner inserts" on public.posts
for insert to authenticated
with check ((select auth.uid()) = user_id);
create policy "posts: owner updates" on public.posts
for update to authenticated
using ((select auth.uid()) = user_id)
with check ((select auth.uid()) = user_id);How do I check views in a Same schema?
Postgres creates views as security definer, so a view on an RLS table can return every row. The Security Advisor flags these with lint 0010. List your views, then set security_invoker on each one.
-- Views in public and their options.
-- A view without security_invoker=true (or =on) runs as its owner and skips RLS.
select c.relname, c.reloptions
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where n.nspname = 'public' and c.relkind = 'v';alter view public.post_feed set (security_invoker = on);What should I check before deploying a Same app?
- Run the RLS and view queries above.
- Run the Supabase Security Advisor and fix every ERROR-level finding.
- Search the source for a secret key with the command below.
- After deploying, run the free /hack-me scan on your domain.
# Look for a secret key before you deploy. This must print nothing.
grep -rnE "sb_secret_|service_role" --exclude-dir=node_modules . 2>/dev/nullFrequently asked questions
- Can a prompt injection reach my Supabase data through Same?
- Supabase calls prompt injection the primary LLM-specific attack on MCP connections, and Same's agent works through the Supabase MCP server. Limit the blast radius: one project, read-only for unattended work, production only when needed.
- Do I need to recheck RLS after every Same prompt?
- After every prompt that changes the schema, yes. Each one can add tables through SQL, which start without RLS. Supahound's free daily scan also reports newly exposed tables.
- Where does Same keep the Supabase keys?
- Same's docs do not say. Search the code before you deploy: a publishable key in client code is expected, a secret key there is a leak.