-
Notifications
You must be signed in to change notification settings - Fork 6
Add Flag to Disable SSL/TLS Certificates Verification #111
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
Conversation
|
|
||
| from urllib3.exceptions import InsecureRequestWarning | ||
|
|
||
| warnings.simplefilter("ignore", InsecureRequestWarning) |
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 suppresses the following warning:
/home/ubuntu/.cache/pypoetry/virtualenvs/groundlight-edge-ZbDJXDWz-py3.10/lib/python3.10/site-packages/urllib3/connectionpool.py:1056: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
robotrapta
left a comment
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.
Nice. A couple changes suggested for precedence logic and picking the configuration.
Co-authored-by: robotrapta <79607467+robotrapta@users.noreply.github.com>
Co-authored-by: robotrapta <79607467+robotrapta@users.noreply.github.com>
…-tls-verification
robotrapta
left a comment
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.
Almost there.
src/groundlight/client.py
Outdated
| ), | ||
| ) from e | ||
|
|
||
| should_disable_tls_verification = disable_tls_verification or bool( |
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.
Still not right. We want the parameter's value in code, if set, to take precedence over the environment variable. Here, if the code sets the value to False but the environment variable is true (1) then the result will be true.
We should only look at the environment variable if the parameter is None.
…hon-sdk into disable-tls-verification
robotrapta
left a comment
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.
Nice! Sorry for the slow review.
Adds a constructor parameter called
disable_tls_verificationand optionally allows users to disable SSL/TLS verification via an env var calledTLS_VERIFY.I tested this on the edge endpoint where I generated self-signed TLS certificates with OpenSSL and then used the SDK from this branch to check that sending requests to an HTTPS server running on local host still works.