Skip to content

Conversation

@blaise-muhirwa
Copy link
Contributor

@blaise-muhirwa blaise-muhirwa commented Oct 12, 2023

Adds a constructor parameter called disable_tls_verification and optionally allows users to disable SSL/TLS verification via an env var called TLS_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.

@blaise-muhirwa blaise-muhirwa marked this pull request as ready for review October 12, 2023 22:47

from urllib3.exceptions import InsecureRequestWarning

warnings.simplefilter("ignore", InsecureRequestWarning)
Copy link
Contributor Author

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(

@blaise-muhirwa blaise-muhirwa changed the title Add Flag to Allow Disable SSL/TLS Certificates Verification Add Flag to Disable SSL/TLS Certificates Verification Oct 12, 2023
Copy link
Member

@robotrapta robotrapta left a 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.

Copy link
Member

@robotrapta robotrapta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there.

),
) from e

should_disable_tls_verification = disable_tls_verification or bool(
Copy link
Member

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.

@mjvogelsong mjvogelsong removed their request for review November 6, 2023 00:59
Copy link
Member

@robotrapta robotrapta left a 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.

@blaise-muhirwa blaise-muhirwa merged commit cd30598 into main Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants