Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion supabase/functions/telemetry-ingest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@ Deno.serve(async (req) => {
return new Response(`Batch too large (max ${MAX_BATCH_SIZE})`, { status: 400 });
}

// Use the anon key, not the service role key.
// The service role key bypasses Row Level Security (RLS) and grants full
// unrestricted database access — wildly over-privileged for a public
// telemetry endpoint that only needs INSERT on two tables.
// The anon key + properly configured RLS INSERT policies is correct.
// See: https://supabase.com/docs/guides/database/postgres/row-level-security
const supabase = createClient(
Deno.env.get("SUPABASE_URL") ?? "",
Deno.env.get("SUPABASE_SERVICE_ROLE_KEY") ?? ""
Deno.env.get("SUPABASE_ANON_KEY") ?? ""
);

// Validate and transform events
Expand Down