Lock down internal tables and quota view#381
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughThree Supabase migrations tighten DB privileges and RLS: lock down internal tables and set the quota view to security_invoker; revoke anon/authenticated EXECUTE on many SECURITY DEFINER helpers; and rewrite RLS policies to use (SELECT auth.uid()) plus pin two functions' search_path. CHANGELOG and advisor docs updated; nine covering FK indexes added. ChangesSecurity Hardening Migration
RPC EXEC Revocations Migration
RLS Optimisation & Function hardening Migration
Docs & Indexes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant View as organisation_quota_status
participant RLS
Caller->>View: SELECT * FROM organisation_quota_status
View->>RLS: evaluate using caller's role/context
RLS->>Caller: return rows filtered by caller's RLS
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Updates to Preview Branch (work/gracious-yonath-dda22f) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
Release VersionsApp patch: ChangelogSecurity
Performance
Documentation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
🐝 Review App Deployed Homepage: https://hover-pr-381.fly.dev |
|
🐝 Review App Deployed Homepage: https://hover-pr-381.fly.dev |
|
🐝 Review App Deployed Homepage: https://hover-pr-381.fly.dev |
|
🐝 Review App Deployed Homepage: https://hover-pr-381.fly.dev |
|
🐝 Review App Deployed Homepage: https://hover-pr-381.fly.dev |
Lock down internal tables and quota view
Summary
Migration A of three, addressing Supabase database linter findings verified against actual usage in this repo.
task_outbox,task_outbox_dead,lighthouse_runs(no policies → deny-all for non-service-role).anon/authenticatedtable grants on the same three tables.security_invoker = trueon theorganisation_quota_statusview so it honours the caller's RLS rather than the creator's.Why this is safe
service role key, which bypasses both grants and RLS. Verified by grepping
internal/,cmd/, andweb/for any usage — no frontend.rpc()or.from()calls reference these objects.unchanged.
Test plan
task_outboxsweeper still drains queued tasks on a review app.lighthouse_runsrows.organisation_quota_statusview returns expected rows for a logged-inorg user.
Need help on this PR? Tag
@codesmithwith what you need.Summary by CodeRabbit
Security
Performance
Documentation