Category: Supabase and databases

Supabase Vault: a secret accessible by the public RPC

Read this guide in Polish

SQL returns private values from Vault to a public token client.

How to identify the source of the problem

Check EXECUTE grants, exposure scheme and SECURITY DEFINITION of the function used.

Compare the result for the authorized and unauthorised user, project name and exact error code.

Repair steps

Move secret reading to trusted backend or remove public function grant.

How to Test Solution

The anonymous client does not read the secret, and the legitimate integration works.

Security and restrictions

Change permissions and scheme first on test data with backup. Do not put service role in your browser.