Skip to content

Commit

Permalink
SNOW-1473581: Fix SSO url validator for nested urls (#1974)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-yixie authored Jun 14, 2024
1 parent a92b91b commit 4b636a7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions DESCRIPTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne
- Fixed a bug that status code shown as uploaded when PUT command failed with 400 error.
- Fixed a bug that a PermissionError was raised when the current user does not have the right permission on parent directory of config file path.
- Fixed a bug that OCSP GET url is not encoded correctly when it contains a slash.
- Fixed a bug that an SSO URL didn't accept `:` in a query parameter, for instance, `https://sso.abc.com/idp/startSSO.ping?PartnerSpId=https://xyz.snowflakecomputing.com/`.

- v3.10.1(May 21, 2024)

Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/connector/url_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


URL_VALIDATOR = re.compile(
"^http(s?)\\:\\/\\/[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z@:])*(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\.\\?\\,\\&\\(\\)\\/\\\\\\+&%\\$#_=@]*)?$"
"^http(s?)\\:\\/\\/[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z@:])*(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\.\\?\\,\\&\\(\\)\\/\\\\\\+&%\\$#_=@:]*)?$"
)


Expand Down
3 changes: 3 additions & 0 deletions test/unit/test_url_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ def test_url_validator():
assert is_valid_url("https://ssoTestURL.okta.com")
assert is_valid_url("https://ssoTestURL.okta.com:8080")
assert is_valid_url("https://ssoTestURL.okta.com/testpathvalue")
assert is_valid_url(
"https://sso.abc.com/idp/startSSO.ping?PartnerSpId=https://xyz.eu-central-1.snowflakecomputing.com/"
)

assert not is_valid_url("-a Calculator")
assert not is_valid_url("This is a random text")
Expand Down

0 comments on commit 4b636a7

Please sign in to comment.