AOSSIE-Org / AOSSIE-Org/Ell-ena

SUPABASE_SERVICE_ROLE_KEY in .env.example may be used client-side in Flutter - service role key bypasses all RLS policies

Aperta
#306 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Dart
Stelle
54
Fork
110
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## Problem

`.env.example` includes `SUPABASE_SERVICE_ROLE_KEY` as a required variable.
The Supabase service role key is a superuser credential that bypasses all
Row-Level Security (RLS) policies. If this key is loaded into the Flutter
client app (e.g. via `--dart-define` or embedded in the app bundle), any user
who extracts it from the compiled app binary can:

1. Read, write, and delete any row in any table, bypassing all RLS policies.
2. Access other users' tasks, tickets, and meeting transcriptions.
3. Delete or corrupt the entire database.

Flutter app binaries are reverse-engineering targets; any secret embedded in
them must be considered public.

## Impact

Complete database compromise if the key is present in the Flutter client build.

## Suggested Fix

1. The service role key must ONLY be used in Supabase Edge Functions
(server-side), never in the Flutter client.
2. Remove `SUPABASE_SERVICE_ROLE_KEY` from any Flutter environment variable
configuration.
3. Audit all usages of `supabaseClient` in the Flutter `lib/` directory to
confirm none of them are initialized with the service role key.
4. Update `.env.example` with a comment explicitly warning:
"SERVICE_ROLE_KEY must never be used in client-side (Flutter) code."
5. Add documentation explaining which keys belong in Edge Functions vs. the
Flutter client.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.