supabase-security

supabase-security is a cursor rule for coding agents from coldtatooine/vuln-skill-pack. It costs 0 tokens per session (588 once invoked), scanned A, original, MIT.

Security rules for Supabase applications, which use a hosted database, login system, file storage, and server functions. They focus on database access policies and secret keys.

In plain words
What is it for?
Reviewing row-level security, checking ownership rules for database actions, protecting the service-role key, and securing public storage.
Why use it?
They help prevent users from reading or changing other users' data and prevent administrator keys from being exposed in the browser.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/coldtatooine/vuln-skill-pack/supabase-security
Clone the repo
git clone --depth 1 https://github.com/coldtatooine/vuln-skill-pack

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for supabase-security

README.md
[![agentmods](https://agentmods.dev/badge/rules/coldtatooine/vuln-skill-pack/supabase-security.svg)](https://agentmods.dev/rules/coldtatooine/vuln-skill-pack/supabase-security)
Your own site
<a href="https://agentmods.dev/rules/coldtatooine/vuln-skill-pack/supabase-security"><img src="https://agentmods.dev/badge/rules/coldtatooine/vuln-skill-pack/supabase-security.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 588 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00588
Opus 5 $0.00000 $0.00294
Sonnet 5 $0.00000 $0.00118
Haiku 4.5 $0.00000 $0.00059

Measured 4d ago against content hash 2dac734bbdc9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

supabase-security scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

cursor/rules/supabase-security.mdc · 32 lines

How it starts

The opening of the file, as written. The whole thing — 32 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Supabase Security Footguns

The Supabase client runs in the browser and talks to the database directly, so RLS is the security boundary — not your application code.

1. Row Level Security (RLS) — the whole ballgame

  • RLS off = the table is fully readable/writable by anyone with the anon key (which ships to the browser). Every API-exposed table MUST have RLS enabled.
  • Permissive policy is the real risk. Common broken policy: USING (true), or one that checks authentication (auth.role() = 'authenticated') but not ownership → any logged-in user reads every row (IDOR at the DB layer).
  • Correct ownership: USING (auth.uid() = user_id). Verify both USING (read) and WITH CHECK (insert/update) — a missing WITH CHECK lets a user write rows they can't read.
  • Check policies for all operations: SELECT, INSERT, UPDATE, DELETE. A table with only a SELECT policy may still be freely deleted.

2. The service_role key

  • service_role bypasses RLS entirely — a full-access admin key. Server-side only. Never in client code, never under a public env prefix, never in the browser bundle. Exposure = Critical, rotate immediately.
  • Use anon key in the browser; service_role only in trusted server contexts.

3. Trusting client-set columns

  • The client can set any column not blocked by a policy. role, is_admin, credits, tenant_id, price must be protected by WITH CHECK or set server-side.
  • Privilege escalation: user updates their own role to admin because the UPDATE policy only checks auth.uid() = user_id.

4. Storage buckets

  • Public buckets serve every object to anyone with the URL. Buckets holding private files must be private with storage RLS policies (separate from table RLS — check explicitly).

5. Auth & other

  • Open signup + auto-confirm can let attackers create accounts freely.
  • security definer functions / RPC run with the definer's privileges — audit them; they can bypass RLS by design.
  • Keep the project JWT secret private — leaking it lets an attacker forge any user's token.

Read the full file on GitHub · 32 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 32 lines · 0 tokens per session scan A 2dac734bbdc9

Subscribe to this mod's changes

supabase-security is a cursor rule published in the GitHub repository coldtatooine/vuln-skill-pack (2 stars, last pushed 9d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 588 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.