FEATURE REQUEST: Update Supabase key system from legacy
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- dart, flutter, supabase, typescript
- Ambito
- backend, cloud, documentation, mobile, security
Direzione di ricerca
Esamina i file di ambiente elencati, patient/lib/main.dart, therapist/lib/main.dart, supabase_assessments_repository.dart, supabase/functions/evaluate-assessments/index.ts, seed_assessments.js e README.md. Inizia tracciando come sono attualmente configurate le chiavi e le intestazioni di autorizzazione, quindi verifica il comportamento del deployment JWT della Supabase Edge Function. Il lavoro è completato quando i nuovi nomi delle chiavi e il flusso di autenticazione funzionano in modo coerente, la documentazione è aggiornata e la decisione sul deployment è registrata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem?
- Yes, it is related to a problem
Describe the feature you'd like
This issue was fully identified and analyzed by myself. Claude was only used to assist with writing in English.
🌟 Feature Description
Currently, NeuroTrack uses Supabase's legacy JWT-based API keys (anon key and service_role key) for all client-server communication. Supabase announced in September 2024 a migration to a new key system — publishable keys (sb_publishable_...) and secret keys (sb_secret_...). As of November 1, 2025, new and restored Supabase projects no longer include legacy keys, and legacy keys are scheduled for permanent deletion in late 2026. This issue tracks the work needed to migrate NeuroTrack to the new key system.
🔍 Problem Statement
The legacy JWT-based keys have several known shortcomings that the new system addresses:
- No independent key rotation without downtime — rotating legacy keys required service interruption
- Mobile app deployment lag — forced key rotation could cause days-to-weeks of downtime for users on older app versions
- Insecure defaults — legacy JWTs had 10-year expiry, were large, hard to parse, and prone to insecure logging
- No granular revocation — compromised keys couldn't be individually revoked
Beyond the general migration, NeuroTrack has a code-level breaking change that goes beyond simple renaming:
-
patient/lib/repository/supabase_assessments_repository.dart— The anon key is manually passed asAuthorization: Bearer $jwtTokenwhen invoking the Edge Function. New publishable keys are not JWTs, so this pattern will fail. The fix is to remove the manual header and rely on the SDK's automatic auth token injection. -
supabase/functions/evaluate-assessments/index.ts— The Edge Function readsSUPABASE_ANON_KEYfrom auto-injected environment variables. After migration, this env var may not auto-update, and JWT verification at the Edge Function level needs to be reviewed (new keys cannot pass JWT verification). -
Environment variables and documentation —
.env.examplefiles inpatient/,therapist/, andsupabase/scripts/, as well asREADME.md, all reference legacy key names.
🎯 Expected Outcome
- Replace all
SUPABASE_ANON_KEYreferences withSUPABASE_PUBLISHABLE_KEY(or equivalent) across Flutter apps, Edge Functions, and environment configs - Replace
SUPABASE_KEY(service role) references withSUPABASE_SECRET_KEYin backend scripts - Refactor
supabase_assessments_repository.dartto stop manually injecting the API key as a Bearer token — instead, let the Supabase SDK handle auth headers automatically - Review Edge Function JWT verification strategy and update deployment config if needed (
--no-verify-jwtor user-JWT-based auth) - Update
README.mdsetup instructions to reflect the new key names
📷 Screenshots and Design Ideas
Affected files:
| File | Change Type |
|---|---|
patient/.env.example |
Rename variable |
therapist/.env.example |
Rename variable |
patient/lib/main.dart |
Update env var name |
therapist/lib/main.dart |
Update env var name |
patient/lib/repository/supabase_assessments_repository.dart |
Code refactor — remove manual Bearer token |
supabase/functions/evaluate-assessments/index.ts |
Update env var + review JWT verification |
supabase/scripts/.env.example |
Rename variable |
supabase/scripts/seed_assessments.js |
Update env var name |
README.md |
Update documentation |
📋 Additional Context
There is an ongoing discussion in the community channel about removing cloud dependencies from the project. The AOSSIE group is moving toward a direction where sensitive data should not reside on external servers, with discussions leaning toward a local database approach. If the decision is made to drop Supabase Cloud in favor of a local database solution, this migration may become unnecessary — the project could continue using the legacy keys until the cloud dependency is removed entirely. This issue should be considered in the context of that broader architectural decision.
References:
- Upcoming changes to Supabase API Keys (Discussion #29260)
- Edge Function env var issue after migration (#37648)
- Community discussion on new API keys (#40300)
Record
- I agree to follow this project's Code of Conduct
- I want to work on implementing this feature
- Lingua principale
- Dart
- Stelle
- 30
- Fork
- 49
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AOSSIE-Org/NeuroTrack
-
fix(therapist): Method marked @override does not override any inherited methodForse già presa @Muneerali199 l’ha presa 252 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
AOSSIE-Org/NeuroTrack#198 ·
-
fix: Don't use BuildContext across async gaps (use_build_context_synchronously)Forse già presa @Muneerali199 l’ha presa 252 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
AOSSIE-Org/NeuroTrack#197 ·
-
fix(patient): Remove unused and duplicate imports across patient appForse già presa @Muneerali199 l’ha presa 252 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AOSSIE-Org/NeuroTrack#195 ·
-
BUG: Therapy details save button has no loading guard, allowing duplicate submissions that inflate patient regression reportsForse già presa @Varadraj75 l’ha presa 215 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
AOSSIE-Org/NeuroTrack#221 ·
-
BUG: Appointment booking ignores selected time slot, every appointment saved at midnight to SupabaseForse già presa @Varadraj75 l’ha presa 220 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
AOSSIE-Org/NeuroTrack#219 ·
Tutte le issue di AOSSIE-Org/NeuroTrack
Issue simili
-
Drop the decision-issue rule from ARCHITECTURE.mdForse già presa @abianche l’ha presa oggi. Apertachore
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 61/100
I maintainer di solito rispondono entro 1 giorno
-
duration: tiny priority: low type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
duobaseio/forui#1249 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Off-by-one error in CharacterRange.length excludes end characters ('z', 'Z', '9', 'ÿ')Forse già presa @TimelordLeo l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
I maintainer di solito rispondono entro 2 giorni
-
[Bug] Missing Simplified Chinese translation for 'balance' and 'lowest' balancer outbound namesApertabug from-telegram platform:android version:v5.9.15
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
hiddify/hiddify-app#2655 ·
I maintainer di solito rispondono entro 1 giorno