Harden webhook route RLS policies - #403
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PUBLIConoutput_routesandwebhook_logsauthenticatedrole and apply least-privilege table grantsoutput_routesrows from the Realtime publication because the application has no subscriberSECURITY.mdwith the working team inboxSecurity impact
Migration 021 created permissive policies without a
TOclause. PostgreSQL therefore applied them toPUBLIC, allowing the unconditional route-read policy to override the workspace-scoped SELECT policy and making the log INSERT policy available to client roles.The production policies have already been removed as an emergency hotfix and anonymous route visibility was verified to return zero rows. Migration 084 makes that containment durable across deployments and adds defence-in-depth role and grant restrictions. The backend remains functional because Supabase
service_rolebypasses RLS.Validation
npm run buildnpx vitest run src/lib/utils.test.ts— 3 tests passedcd task-runner && npm run buildcd task-runner && npx vitest run src— 18 tests passedanon:select count(*) from public.output_routesreturned0after containmentOperational follow-up
Credential rotation and historical log review are tracked as incident-response follow-up and are intentionally separate from this code change.