feat: add RLS operation ergonomics#903
Conversation
59b5086 to
19c5079
Compare
21a8e02 to
512fcd9
Compare
512fcd9 to
efd53ad
Compare
There was a problem hiding this comment.
Pull request overview
Adds higher-level PostgreSQL helpers for operation-aware RLS policies (based on the storage.operation GUC) and wires legacy operation names into the centralized operation registry, with accompanying tests to validate matching semantics.
Changes:
- Introduces
storage.allow_only_operation(text)andstorage.allow_any_operation(text[])migration helpers to simplify RLS policy authoring. - Centralizes/extends route operation constants (including legacy
object.*_authenticated_info) and updatesgetObjectInforoutes to use them. - Adds integration coverage in
rls_tests.yamland a new Jest test suite validating operation helper behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/rls_tests.yaml | Adds policy + integration test cases exercising the new operation helper functions in RLS. |
| src/test/operation-helpers.test.ts | New unit-style DB tests validating normalization and matching semantics of the helpers. |
| src/internal/database/migrations/types.ts | Registers the new migration name/version (operation-ergonomics: 57). |
| src/http/routes/operations.ts | Adds file header docs and introduces legacy object.*_authenticated_info operation constants. |
| src/http/routes/object/getObjectInfo.ts | Switches route operation strings to ROUTE_OPERATIONS.* constants for consistency. |
| migrations/tenant/57-operation-ergonomics.sql | Adds the new SQL helper functions used in ergonomic RLS policies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
efd53ad to
409b131
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3a822c5 to
970a3c7
Compare
| GET_AUTH_OBJECT_INFO: 'object.get_authenticated_info', // legacy | ||
| HEAD_AUTH_OBJECT_INFO: 'object.head_authenticated_info', // legacy |
There was a problem hiding this comment.
@fenos these are the two operations that don't follow others
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
970a3c7 to
20da0f6
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
## What kind of change does this PR introduce? Docs ## What is the new behavior? Documents new Storage operation RLS helpers. ## Additional context Related to supabase/storage#903 Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com> Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
What kind of change does this PR introduce?
Feature
What is the current behavior?
Users need to write raw comparisons which can be brittle.
What is the new behavior?
A bit higher level helpers to ease writing a policy.
Additional context