Skip to content

Commit 201aa58

Browse files
sfc-gh-dszmolkasfc-gh-pczajka
authored andcommitted
SNOW-1920533 match privatelink in hostname to setup correct privatelink OCSP Cache url even if user specifies account in UPPERCASE (#2169)
1 parent 387f764 commit 201aa58

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

DESCRIPTION.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ https://docs.snowflake.com/
77
Source code is also available at: https://github.com/snowflakedb/snowflake-connector-python
88

99
# Release Notes
10+
- v3.13.3(TBD)
11+
- Bumped pyOpenSSL dependency upper boundary from <25.0.0 to <26.0.0.
12+
- Removed the workaround for a Python 2.7 bug.
13+
- Added a <19.0.0 pin to pyarrow as a workaround to a bug affecting Azure Batch.
14+
- Optimized distribution package lookup to speed up import.
15+
- Fixed a bug where privatelink OCSP Cache url could not be determined if privatelink account name was specified in uppercase
1016

1117
- v3.12.4(TBD)
1218
- Fixed a bug where multipart uploads to Azure would be missing their MD5 hashes.

src/snowflake/connector/connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,7 @@ def __set_error_attributes(self) -> None:
916916

917917
@staticmethod
918918
def setup_ocsp_privatelink(app, hostname) -> None:
919+
hostname = hostname.lower()
919920
SnowflakeConnection.OCSP_ENV_LOCK.acquire()
920921
ocsp_cache_server = f"http://ocsp.{hostname}/ocsp_response_cache.json"
921922
os.environ["SF_OCSP_RESPONSE_CACHE_SERVER_URL"] = ocsp_cache_server
@@ -947,7 +948,7 @@ def __open_connection(self):
947948
os.environ["SF_OCSP_RESPONSE_CACHE_SERVER_URL"],
948949
)
949950

950-
if ".privatelink.snowflakecomputing." in self.host:
951+
if ".privatelink.snowflakecomputing." in self.host.lower():
951952
SnowflakeConnection.setup_ocsp_privatelink(self.application, self.host)
952953
else:
953954
if "SF_OCSP_RESPONSE_CACHE_SERVER_URL" in os.environ:

test/integ/test_connection.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,19 @@ def test_privatelink_ocsp_url_creation():
672672
)
673673

674674

675+
@pytest.mark.skipolddriver
676+
def test_uppercase_privatelink_ocsp_url_creation():
677+
account = "TESTACCOUNT.US-EAST-1.PRIVATELINK"
678+
hostname = account + ".snowflakecomputing.com"
679+
680+
SnowflakeConnection.setup_ocsp_privatelink(CLIENT_NAME, hostname)
681+
ocsp_cache_server = os.getenv("SF_OCSP_RESPONSE_CACHE_SERVER_URL", None)
682+
assert (
683+
ocsp_cache_server
684+
== "http://ocsp.testaccount.us-east-1.privatelink.snowflakecomputing.com/ocsp_response_cache.json"
685+
)
686+
687+
675688
def test_privatelink_ocsp_url_multithreaded():
676689
bucket = queue.Queue()
677690

0 commit comments

Comments
 (0)