Skip to main content
InfoSecretsOWASP A07:2021CWE-798

How to fix: Supabase anon key in source

Supabase anon keys are public by design. Security depends on RLS policies.

Why it matters

Supabase anon keys are intentionally public. Their presence alone is not a vulnerability. The risk is that missing or overly permissive Row Level Security (RLS) policies combined with the key allow unauthenticated users to read or write data they should not access.

Supabase anon keys are public by design. Security depends on RLS policies.

How to fix it

  1. 1Enable RLS on every table: ALTER TABLE your_table ENABLE ROW LEVEL SECURITY
  2. 2Add explicit policies for each role (anon, authenticated)
  3. 3Test RLS with the Supabase Policy Simulator before deploying

Code examples

Enable RLS and create policies

SQL
-- Enable RLS on the table
ALTER TABLE posts ENABLE ROW LEVEL SECURITY;

-- Only authenticated users can read
CREATE POLICY "Authenticated users can read posts"
  ON posts FOR SELECT
  TO authenticated
  USING (true);

-- Users can only update their own posts
CREATE POLICY "Users can update own posts"
  ON posts FOR UPDATE
  TO authenticated
  USING (auth.uid() = user_id);

-- No anonymous access
CREATE POLICY "No anon access"
  ON posts FOR ALL
  TO anon
  USING (false);

References

Detected automatically by VulnRadar. The check id is secret-supabase-anon-key, stable across every scan so you can filter or diff on it.

See every secrets check

Questions

How severe is Supabase anon key in source?
VulnRadar rates this info severity in the secrets category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id secret-supabase-anon-key, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Supabase anon key in source map to?
It maps to CWE-798. In the OWASP Top 10 it falls under A07:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for supabase anon key in source

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: Supabase anon key in source | VulnRadar