snowflakedb / snowflake-connector-python

Snowflake Connector for Python
https://pypi.python.org/pypi/snowflake-connector-python/
Apache License 2.0
568 stars 456 forks source link

SNOW-1473581: Nested URL within the query parameter is not adequately handled by the regex pattern #1973

Closed roya-khalili closed 3 weeks ago

roya-khalili commented 3 weeks ago

Python version

3.11.5

Operating system and processor architecture

Microsoft windows 10 Enterprise

Installed packages

-

What did you do?

I need to add :  to Snowflake_connector_pattern. 
The URL_validator variable is contained "^http(s?)\\:\\/\\/[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z@:])*(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\.\\?\\,\\&\\(\\)\\/\\\\\\+&%\\$#_=@]*)?$"
but I got this  "message": (f"The SSO URL provided {sso_url} is invalid"). 
The reason is that there is : in the nested URL that we are using.
Our SAML2_SSO_URL('https://sso.mercedes-benz.com/idp/startSSO.ping?PartnerSpId=https://athlon.eu-central-1.snowflakecomputing.com/').

What did you expect to see?

I expect to do not get error when I run DBT.

Can you set logging to DEBUG and collect the logs?

import logging
import os

for logger_name in ('snowflake.connector',):
    logger = logging.getLogger(logger_name)
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s'))
    logger.addHandler(ch)