BUG: changeAppointmentStatus has no ownership check - any therapist can accept or decline another therapist's session
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- dart, supabase
- Domain
- authorization, databases, security
Research direction
Start in therapist/lib/repository/supabase_therapist_repository.dart around line 58 and inspect changeAppointmentStatus, including how the authenticated therapist ID is obtained from Supabase Auth. Reproduce the update with sessions belonging to two therapists; done means a therapist can change only their own session and another therapist's session remains unchanged or returns an authorization error.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
📌 Issue Overview
changeAppointmentStatus updates a session's status by id alone with
no check that the session belongs to the currently authenticated therapist.
Any authenticated therapist who knows another session's UUID can accept,
decline, or modify it. RLS is also disabled on the session table, so
there is no database-level safety net either.
🔍 Steps to Reproduce
- Authenticate as Therapist A
- Obtain any session UUID assigned to Therapist B
- Call
changeAppointmentStatuswith Therapist B's session ID and
status = 'declined' - Therapist B's session is modified without any authorization error
SQL proof — this is exactly what the current code executes:
-- No ownership check — succeeds for ANY session ID
UPDATE session SET status = 'declined' WHERE id = '';
-- Success — modified 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
changeAppointmentStatus should only update sessions where therapist_id
matches the currently authenticated therapist's ID. Any attempt to modify
another therapist's session should fail silently (0 rows affected) or
return an authorization error.
🚨 Actual Behavior
Any authenticated therapist can accept, decline, or modify any session in
the database by supplying its UUID.
therapist/lib/repository/supabase_therapist_repository.dart, line 58:
await _supabaseClient.from('session')
.update({'status': status})
.eq('id', appointmentId); // no ownership check
📷 Screenshot
N/A
💡 Suggested Improvements
Add .eq('therapist_id', _supabaseClient.auth.currentUser!.id) to scope
the update to the authenticated therapist only:
await _supabaseClient.from('session')
.update({'status': status})
.eq('id', appointmentId)
.eq('therapist_id', _supabaseClient.auth.currentUser!.id); // ownership check
Record
- I agree to follow this project's Code of Conduct
- I want to work on this issue
- Dominant language
- Dart
- Stars
- 30
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AOSSIE-Org/NeuroTrack
-
fix(therapist): Method marked @override does not override any inherited methodPossibly taken @Muneerali199 claimed this 259 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AOSSIE-Org/NeuroTrack#198 ·
-
fix: Don't use BuildContext across async gaps (use_build_context_synchronously)Possibly taken @Muneerali199 claimed this 259 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AOSSIE-Org/NeuroTrack#197 ·
-
fix(patient): Remove unused and duplicate imports across patient appPossibly taken @Muneerali199 claimed this 259 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AOSSIE-Org/NeuroTrack#195 ·
-
BUG: Therapy details save button has no loading guard, allowing duplicate submissions that inflate patient regression reportsPossibly taken @Varadraj75 claimed this 222 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 68/100
AOSSIE-Org/NeuroTrack#221 ·
-
BUG: Appointment booking ignores selected time slot, every appointment saved at midnight to SupabasePossibly taken @Varadraj75 claimed this 227 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
AOSSIE-Org/NeuroTrack#219 ·
All issues in AOSSIE-Org/NeuroTrack
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Anxcye/anx-reader#1024 ·
-
[cloud_functions]: Apple platforms ignore custom domains passed as regionPossibly taken @ragavendranbala-TSL claimed this today. OpenNeeds Attention platform: ios platform: macos plugin: functions type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
firebase/flutterfire#19015 · 2 comments ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RevenueCat/purchases-flutter#2048 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
hajisensai/Fushi#4543 · 3 comments ·
Maintainers usually reply within 1 day
-
[video_player] _updatePosition sets isCompleted=true after 500ms when duration is Duration.zeroOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day