BUG: deleteAppointment has no ownership check - any patient can delete another patient's session
@Varadraj75 ci sta già lavorando.
Dal 27/2/2026.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- dart, supabase
- Ambito
- authorization, databases, security
Direzione di ricerca
Inizia in patient/lib/repository/supabase_patient_repository.dart intorno alla riga 126 e verifica come deleteAppointment autentica il paziente corrente ed elimina dalla sessione. Esamina la configurazione RLS della tabella session come livello di protezione separato. Il lavoro è completato quando un paziente non può eliminare la session di un altro paziente, mentre l’eliminazione della propria continua a funzionare, e la protezione richiesta a livello di database è stata implementata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there an existing issue for this?
- I have searched the existing issues
What happened?
📌 Issue Overview
deleteAppointment deletes a session by id alone with no check that the
session belongs to the currently authenticated patient. Any authenticated
patient who knows another session's UUID can delete it. RLS is also
disabled on the session table, meaning there is no database-level
safety net either.
🔍 Steps to Reproduce
- Authenticate as Patient A
- Obtain any session UUID (e.g., from network tab or API response)
- Call
deleteAppointmentwith Patient B's session ID - Patient B's session is silently deleted — no authorization error
SQL proof — this is exactly what the current code executes:
-- No ownership check — succeeds for ANY session ID
DELETE FROM session WHERE id = '';
-- Success. No rows returned (deleted without auth check)
RLS check:
SELECT tablename, rowsecurity FROM pg_tables
WHERE schemaname = 'public' AND tablename = 'session';
-- returns: session | false (no database-level protection)
🎯 Expected Behavior
deleteAppointment should only delete sessions where patient_id matches
the currently authenticated user's ID. Attempts to delete another
patient's session should fail silently (0 rows affected) or return an
authorization error.
🚨 Actual Behavior
Any authenticated patient can delete any session in the database by
supplying its UUID. RLS is disabled so there is no safety net at the
DB level either.
patient/lib/repository/supabase_patient_repository.dart, line 126:
await _supabaseClient.from('session')
.delete()
.eq('id', id); // no ownership check — deletes any session
📷 Screenshot
N/A
💡 Suggested Improvements
Add .eq('patient_id', _supabaseClient.auth.currentUser!.id) to scope
the delete to the authenticated patient only:
await _supabaseClient.from('session')
.delete()
.eq('id', id)
.eq('patient_id', _supabaseClient.auth.currentUser!.id); // ownership check
Additionally, enable RLS on the session table and add a policy that
restricts patients to only deleting their own sessions as a
defence-in-depth measure.
Record
- I agree to follow this project's Code of Conduct
- I want to work on this issue
- 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