Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RLS: Adding a new filter! macro #1849

Merged
merged 4 commits into from
Oct 17, 2024
Merged

RLS: Adding a new filter! macro #1849

merged 4 commits into from
Oct 17, 2024

Conversation

mamcx
Copy link
Contributor

@mamcx mamcx commented Oct 14, 2024

Description of Changes

Add a new filter! proc-macro for defining row-level security policies (rls) using SQL.

It is a continuation of #1746.

Closes #1602.

The new macro:

  • Only checks the syntax of the SQL query at compile time using the subscription dialect. It is impossible to fully validate it until we publish the module and all the table definitions are already committed to the database.
  • Can be placed anywhere in the module

To avoid tracking a graph of dependencies, we remove and then add against all the rls and finally compile them to validate it.

Expected complexity level and risk

1

Testing

Describe any testing you've done, and any testing you'd like your reviewers to do,
so that you're confident that all the changes work as expected!

  • Unit testing that assert the presence of the migration steps.
  • Update smoke test auto_migration.py.
  • Manual inspection using the cli

@mamcx mamcx added enhancement New feature or request release-1.0 labels Oct 14, 2024
@mamcx mamcx self-assigned this Oct 14, 2024
crates/core/src/db/update.rs Outdated Show resolved Hide resolved
@mamcx mamcx force-pushed the mamcx/filter-proc_macro branch from 7a34585 to 6e1b654 Compare October 14, 2024 17:47
@joshua-spacetime joshua-spacetime linked an issue Oct 15, 2024 that may be closed by this pull request
crates/bindings-macro/Cargo.toml Show resolved Hide resolved
crates/bindings-macro/src/lib.rs Show resolved Hide resolved
crates/bindings-macro/src/lib.rs Show resolved Hide resolved
crates/bindings-macro/src/lib.rs Show resolved Hide resolved
@joshua-spacetime joshua-spacetime changed the title Adding a new filter! macro RLS: Adding a new filter! macro Oct 15, 2024
crates/schema/src/auto_migrate.rs Show resolved Hide resolved
crates/schema/src/auto_migrate.rs Outdated Show resolved Hide resolved
crates/expr/src/errors.rs Outdated Show resolved Hide resolved
crates/core/src/sql/parser.rs Show resolved Hide resolved
crates/core/src/sql/parser.rs Outdated Show resolved Hide resolved
crates/core/src/db/update.rs Outdated Show resolved Hide resolved
crates/core/src/db/update.rs Show resolved Hide resolved
@mamcx mamcx force-pushed the mamcx/filter-proc_macro branch 2 times, most recently from 21104a5 to 3d182f0 Compare October 17, 2024 14:19
@mamcx mamcx enabled auto-merge October 17, 2024 14:51
mamcx and others added 4 commits October 17, 2024 12:47
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>
@mamcx mamcx force-pushed the mamcx/filter-proc_macro branch from 3d182f0 to ab45658 Compare October 17, 2024 17:52
@mamcx mamcx added this pull request to the merge queue Oct 17, 2024
Merged via the queue into master with commit 637d6d7 Oct 17, 2024
8 checks passed
lcodes pushed a commit that referenced this pull request Oct 25, 2024
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request release-1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RLS: Update describe_module schema RLS: Implement the filter! proc macro
3 participants