This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git


The following commit(s) were added to refs/heads/main by this push:
     new 758b498d Limit split so colons are allowed in the password (#2706)
758b498d is described below

commit 758b498d81634bf27dc51173c319dba1c4e02e6f
Author: Leandro Martelli <[email protected]>
AuthorDate: Mon Nov 10 18:57:38 2025 +0100

    Limit split so colons are allowed in the password (#2706)
    
    <!--
    Thanks for opening a pull request!
    -->
    
    <!-- In the case this PR will resolve an issue, please replace
    ${GITHUB_ISSUE_ID} below with the actual Github issue id. -->
    <!-- Closes #${GITHUB_ISSUE_ID} -->
    
    # Rationale for this change
    
    As of now, pyiceberg will fail if the provided catalog secret contains a
    colon.
    By limiting the split, this gets fixed.
    
    ## Are these changes tested?
    
    Yes, locally with `make test` (the test was modified to include a colon
    in the secret) and also with a live system.
    
    ## Are there any user-facing changes?
    
    Not exactly, just a bug fix.
    
    <!-- In the case of user-facing changes, please add the changelog label.
    -->
    
    Co-authored-by: Leandro Martelli <[email protected]>
---
 pyiceberg/catalog/rest/auth.py | 2 +-
 tests/catalog/test_rest.py     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pyiceberg/catalog/rest/auth.py b/pyiceberg/catalog/rest/auth.py
index 48e49f08..7f56f630 100644
--- a/pyiceberg/catalog/rest/auth.py
+++ b/pyiceberg/catalog/rest/auth.py
@@ -95,7 +95,7 @@ class LegacyOAuth2AuthManager(AuthManager):
 
     def _fetch_access_token(self, credential: str) -> str:
         if COLON in credential:
-            client_id, client_secret = credential.split(COLON)
+            client_id, client_secret = credential.split(COLON, maxsplit=1)
         else:
             client_id, client_secret = None, credential
 
diff --git a/tests/catalog/test_rest.py b/tests/catalog/test_rest.py
index fb0e2607..d2ecd02a 100644
--- a/tests/catalog/test_rest.py
+++ b/tests/catalog/test_rest.py
@@ -50,7 +50,7 @@ from pyiceberg.typedef import RecursiveDict
 from pyiceberg.utils.config import Config
 
 TEST_URI = "https://iceberg-test-catalog/";
-TEST_CREDENTIALS = "client:secret"
+TEST_CREDENTIALS = "client:secret_with:colon"
 TEST_OAUTH2_SERVER_URI = "https://auth-endpoint/";
 TEST_TOKEN = "some_jwt_token"
 TEST_SCOPE = "openid_offline_corpds_ds_profile"

Reply via email to