Abbi Labs

2026-11-27 · Daily security tips

Can any user add themselves to someone else's team?

Team apps often have a team_members table, and the other tables' RLS policies say: you can see a row if you're a member of its team. Then the insert policy on team_members gets written like any own-row policy: with check ((select auth.uid()) = user_id). That only checks the user_id. Anyone signed in can insert their own id next to another team's team_id, and every membership-based policy now lets them in.

Check: in the SQL Editor, run select policyname, with_check from pg_policies where tablename = 'team_members' and cmd in ('INSERT', 'ALL'); If team_id isn't checked, test it: as account B, insert a row with A's team_id.

Fix: don't let users insert memberships directly. Add members from server code once an invite is accepted, or only allow inserts by someone who is already an owner of that team.

The full guide has the pg_policies query, a two-account test, owner-only insert SQL with a security definer function, and the fix for 42P17 infinite recursion in team_members policies.

Read the team_members RLS guide →

Is your live site exposing something like this?

The free quick check looks at what your site already serves publicly: secret keys in your JavaScript, open /.env files and /.git folders, Supabase tables readable with your public key, missing security headers, CORS misconfiguration, insecure cookie flags and TLS certificate expiry. No sign-up needed.

No app handy?

Example result · our deliberately broken demo app

6 issues found: 3 critical, 1 high, 1 medium, 1 low

  • Critical: Stripe live secret key in public JavaScript
  • Critical: /.env file readable by anyone
  • High: Git repository exposed (/.git/HEAD)

The demo's problems are planted on purpose. Paste your own URL above to see yours.

No sign-up. Read-only public-resource and protocol metadata checks. No model prompts or tool execution. Scan only sites you own or are allowed to test.

Run on every deploy or use from Cursor / Claude Code via MCP →

Weekly AI-app security checklist

One short email a week: a practical check for apps built with Supabase, Next.js and AI tools (RLS, leaked keys, headers and more). Unsubscribe anytime.