From 78220bfe626f2486b8b4270f0ba6428193543514 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 20 Jun 2025 14:12:01 -0300 Subject: [PATCH 1/3] fix: remove jwt key validation to allow new api keys --- supabase/_async/client.py | 6 ------ supabase/_sync/client.py | 6 ------ 2 files changed, 12 deletions(-) diff --git a/supabase/_async/client.py b/supabase/_async/client.py index 1f593135..fee425b5 100644 --- a/supabase/_async/client.py +++ b/supabase/_async/client.py @@ -58,12 +58,6 @@ def __init__( if not re.match(r"^(https?)://.+", supabase_url): raise SupabaseException("Invalid URL") - # Check if the key is a valid JWT - if not re.match( - r"^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$", supabase_key - ): - raise SupabaseException("Invalid API key") - if options is None: options = ClientOptions(storage=AsyncMemoryStorage()) diff --git a/supabase/_sync/client.py b/supabase/_sync/client.py index a945716c..eae5bff1 100644 --- a/supabase/_sync/client.py +++ b/supabase/_sync/client.py @@ -57,12 +57,6 @@ def __init__( if not re.match(r"^(https?)://.+", supabase_url): raise SupabaseException("Invalid URL") - # Check if the key is a valid JWT - if not re.match( - r"^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$", supabase_key - ): - raise SupabaseException("Invalid API key") - if options is None: options = ClientOptions(storage=SyncMemoryStorage()) From a65ac2b1f9f7f178d46eed78e6d24e8d90c5f2be Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 20 Jun 2025 14:25:17 -0300 Subject: [PATCH 2/3] remove tests # Conflicts: # tests/test_client.py --- tests/test_client.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index b0105c4a..b25921f9 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,26 +1,9 @@ from __future__ import annotations import os -from typing import Any from unittest.mock import MagicMock -import pytest -from gotrue import SyncMemoryStorage - -from supabase import Client, ClientOptions, SupabaseException, create_client - - -@pytest.mark.xfail( - reason="None of these values should be able to instantiate a client object" -) -@pytest.mark.parametrize("url", ["", None, "valeefgpoqwjgpj", 139, -1, {}, []]) -@pytest.mark.parametrize("key", ["", None, "valeefgpoqwjgpj", 139, -1, {}, []]) -def test_incorrect_values_dont_instantiate_client(url: Any, key: Any) -> None: - """Ensure we can't instantiate client with invalid values.""" - try: - _: Client = create_client(url, key) - except SupabaseException as e: - pass +from supabase import ClientOptions, create_client def test_function_initialization() -> None: From 064326ba344e7afd982d5295191f546a372e80a7 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 20 Jun 2025 14:39:57 -0300 Subject: [PATCH 3/3] fix test --- tests/test_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_client.py b/tests/test_client.py index b25921f9..ef51f6bd 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -3,6 +3,8 @@ import os from unittest.mock import MagicMock +from gotrue import SyncMemoryStorage + from supabase import ClientOptions, create_client