BUG: Missing RLS policies occur DB access error(P42501)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with schema.sql and the Supabase RLS behavior by deploying the schema and reproducing the patient onboarding insert. Review the listed 14-table access patterns and the dependency on PR #156, then verify authenticated patient and therapist operations no longer return 42501, including the additional therapist_type policy after PR #156 merges.
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?
This issue and related PR were fully identified and analyzed by myself. Claude was only used to assist with writing descriptions in English.
📌 Issue Overview
schema.sql defines all tables but has no Row Level Security (RLS) policies. When RLS is enabled on Supabase (default behavior), all authenticated operations are blocked with 42501 errors because no policies exist to grant access.
🔍 Steps to Reproduce
- Deploy the schema to a Supabase project
- Sign up and log in as a patient
- Complete the onboarding flow (insert into
patienttable)
🎯 Expected Behavior
Authenticated users should be able to perform CRUD operations on their own records according to their role (patient or therapist).
🚨 Actual Behavior
All DB operations fail with:
PostgrestException(message: new row violates row-level security policy for table "patient", code: 42501)
💡 Suggested Improvements
Add RLS policies for all 14 tables in schema.sql with the following access patterns:
| Table | Policy |
|---|---|
therapist |
Own record INSERT/SELECT/UPDATE via auth.uid() |
patient |
Own record INSERT/SELECT/UPDATE + therapist can SELECT their patients |
package |
Read-only for all authenticated users |
session |
Therapist full CRUD on own sessions, patient SELECT/INSERT/UPDATE on own sessions |
therapy |
Read-only for all authenticated users |
therapy_goal |
Therapist full CRUD, patient SELECT on own goals |
assessments |
Read-only for all authenticated users |
assessment_results |
Patient INSERT/SELECT own results, therapist SELECT their patients' results |
goal_master, observation_master, regression_master, activity_master |
Read-only for all authenticated users |
daily_activities |
Therapist full CRUD, patient SELECT own activities |
daily_activity_logs |
Patient full CRUD on own logs, therapist SELECT their patients' logs |
Improvement PR is ready and waiting for PR #156 been merged.
When PR #156 is merged, additional policy for table
therapist_typewould be needed.
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