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
- Dominant language
- Dart
- Stars
- 54
- Forks
- 110
- PR merge metrics
- No merged PRs in 30d
Description
## 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.