Enforces strict isolation of service_role key to server-side contexts only.
77
97%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Enforces strict isolation of service_role key to server-side contexts only.
The service_role key bypasses Row Level Security and has full database access. This tile enforces that the key is NEVER present in client-side code, browser bundles, or public environment variables. All privileged operations MUST route through server-only contexts — either server-side Supabase clients or SECURITY DEFINER Postgres functions with restricted grants.
// lib/supabase-admin.ts
import 'server-only';
import { createClient } from '@supabase/supabase-js';
export const supabaseAdmin = createClient(
process.env.SUPABASE_URL!,
process.env.SUPABASE_SERVICE_ROLE_KEY!
);| Variable | Scope | Exposed to Client |
|---|---|---|
SUPABASE_URL | Both | Yes |
SUPABASE_ANON_KEY | Both | Yes |
SUPABASE_SERVICE_ROLE_KEY | Server only | NEVER |
REVOKE EXECUTE ON FUNCTION admin_operation FROM public, anon, authenticated;
GRANT EXECUTE ON FUNCTION admin_operation TO service_role;supabase-mcp-verification. All tiles that perform admin operations MUST comply with this boundary.