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

Postgrest Client session is not the same as Supabase Client instance one #828

Closed
xiaoland opened this issue Jun 11, 2024 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@xiaoland
Copy link

Bug report

Describe the bug

I have a supabase client created in middleware which uses the user's access token, and a service role key supabase client created at the FastAPI app initializing.

However, I found out the header Authorization in these two supabase client's Postgres client session's content is the same!

For service role key supabase client:
image

For request client:
image
image

So the service role key cannot bypass the RLS, I'm really confused with it. Shouldn't every supabase client request supabase using its own session?

To Reproduce

  1. init a supabase client with create_client(url, serv_key)
  2. init another supabase client with create_client(url, anon_key)
  3. anon_client.auth.set_session(access_token)
    • access_token is the jwt of an authenticated user
  4. send PostgreSQL op using supabase serv client (if you set RLS, you will find it failed to update)

Expected behavior

Every client should be completely independent.

System information

  • OS: Windows10
  • Supabase-Py: 2.5.0

😉 Hope for your reply, sincere appreciation to your work!

@xiaoland xiaoland added the bug Something isn't working label Jun 11, 2024
@xiaoland
Copy link
Author

might be a false positive

@xiaoland
Copy link
Author

The reason is:
image

I share them the same ClientOptions ... I check the source and found out it has significant effect on headers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant