Skip to content

RLS policies implementation#95

Open
Swayymalcolm99 wants to merge 1 commit into
StepFi-app:mainfrom
Swayymalcolm99:main
Open

RLS policies implementation#95
Swayymalcolm99 wants to merge 1 commit into
StepFi-app:mainfrom
Swayymalcolm99:main

Conversation

@Swayymalcolm99

Copy link
Copy Markdown

Closes #32
Added Row Level Security (RLS) policies to prevent unauthorized data access
File Changed
20260718000000_rls_policies.sql (new)
What Was Implemented
Created RLS policies for 6 tables to ensure users can only access their own data:

learner_profiles - Users can read/insert/update their own profile
loans - Users can read their own loans; service role can insert/update (for indexer)
vouches - Users can read where they're mentor or learner; mentors can insert/update
vendors - Public read access (authenticated users); service role full access
liquidity_positions (pool_positions) - Users can read their own; service role insert/update
sponsor_pools - Users can read/insert/update their own sponsor pool
Key Design Decisions
Uses Postgres session variable app.current_wallet for wallet-based authentication
Service role bypasses RLS automatically for admin/indexer operations
repayment_installments table doesn't exist - payment_index is used instead (service role managed)
pool_positions is implemented as liquidity_positions
Testing
All CI checks pass: npm install , npm run build , npm test (288/288 tests)
Acceptance Criteria Met
All tables have RLS enabled (from previous migration)
Users can only access their own data
Public data (vendors) accessible without auth
Admin operations use service role
npm run build passes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: implement Supabase Row Level Security for all tables

2 participants