-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SNOW-761004 Added URL Validator and URL escaping of strings #1480
SNOW-761004 Added URL Validator and URL escaping of strings #1480
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
Codecov Report
@@ Coverage Diff @@
## main #1480 +/- ##
==========================================
+ Coverage 81.90% 81.99% +0.09%
==========================================
Files 60 61 +1
Lines 8598 8616 +18
Branches 1271 1273 +2
==========================================
+ Hits 7042 7065 +23
+ Misses 1223 1218 -5
Partials 333 333
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Please rebase your PR @sfc-gh-hchaturvedi we have updated the license header years to include 2023 |
@sfc-gh-mkeller @sfc-gh-hchaturvedi is this good to merge? |
Returns: | ||
URL encoded string | ||
""" | ||
if target is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does target
evaluate to None
?
Why do we need this wrapper if it's just a one-liner calling urllib.parse.quote_plus
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be part of the OCSP Code base where we need to make sure all the OCSP Request besides being baset64 encoded are also URL Encoded. The OCSP Code base depends a lot on what is received int the certificate from the Certificate authority. If in case the information is bad and the certificate request generated turns out to be None this case should catch that. This utility function also gives us the ability to add more such cases which I am sure there will be.
@sfc-gh-hchaturvedi @sfc-gh-stan checking status on this as the release is waiting on this. Looks the merge gates are failing on this. |
test/unit/test_url_util.py
Outdated
# | ||
import pytest | ||
|
||
from snowflake.connector.url_util import is_valid_url, url_encode_str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also need to ignore the import error otherwise other driver just doesn't have this module or we vendor the method in the tests folder
from snowflake.connector.url_util import is_valid_url, url_encode_str | |
try: | |
from snowflake.connector.url_util import is_valid_url, url_encode_str | |
except ImportError: | |
is_valid_url = None | |
url_encode_str = None |
e37b53c
to
d5ed78b
Compare
Co-authored-by: Mark Keller <[email protected]>
Co-authored-by: Mark Keller <[email protected]>
Co-authored-by: Mark Keller <[email protected]>
Co-authored-by: Mark Keller <[email protected]>
d5ed78b
to
ef92f28
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 🚢
Please answer these questions before submitting your pull requests. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-761004
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Currently Python connector does not ensure the validity of the SSO URL and just opens it in the browser. The connector should ensure that the URL is a valid HTTP / HTTPS URL before passing it to the Browser. This PR also adds support for URL encoding strings. This will be used later for encoding Base64 OCSP requests before sending them to the OCSP Responder.