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

Fix issue of RLS not working with Postgrest and Storage #560

Merged
merged 3 commits into from
Sep 26, 2023

Conversation

silentworks
Copy link
Contributor

@silentworks silentworks commented Sep 24, 2023

What kind of change does this PR introduce?

This will now allow the correct auth headers for a authenticated user to be passed over to the postgrest client. In this setup the postgrest and storage client are lazy initialised and each time a event triggers that could cause an auth token to update we reset the private variable holding the postgrest and storage clients.

What is the current behavior?

No complying with the RLS policies without handling it in your code yourself

What is the new behavior?

Automatic handling of complying with the RLS polices with postgrest and storage.

Additional context

Fixes #185

@codecov
Copy link

codecov bot commented Sep 24, 2023

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (a56913c) 79.39% compared to head (189582d) 72.34%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #560      +/-   ##
===========================================
- Coverage    79.39%   72.34%   -7.06%     
===========================================
  Files            9        9              
  Lines          165      188      +23     
===========================================
+ Hits           131      136       +5     
- Misses          34       52      +18     
Files Coverage Δ
supabase/client.py 73.49% <39.28%> (-19.84%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@silentworks silentworks changed the title Fix issue of RLS not working with Postgrest Fix issue of RLS not working with Postgrest and Storage Sep 26, 2023
Copy link
Contributor

@J0 J0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm if tested

@ShantanuNair
Copy link
Contributor

@silentworks Much appreciated!!

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.

RLS not working after sign-in
3 participants