-
Notifications
You must be signed in to change notification settings - Fork 520
SNOW-2176524 bump up vendored urllib3 to 2.5.0 and requests to v2.32.5 #2504
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
base: main
Are you sure you want to change the base?
SNOW-2176524 bump up vendored urllib3 to 2.5.0 and requests to v2.32.5 #2504
Conversation
return ssl_context.wrap_socket(sock, server_hostname=server_hostname) | ||
else: | ||
return ssl_context.wrap_socket(sock) | ||
return ssl_context.wrap_socket(sock, server_hostname=server_hostname) |
Check failure
Code scanning / CodeQL
Use of insecure SSL/TLS version High
call to SSLContext
Insecure SSL/TLS protocol version TLSv1_1 allowed by
call to SSLContext
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 23 days ago
To fix this problem, ensure that the SSL context always enforces TLSv1.2 or higher, regardless of caller-supplied arguments.
- If the caller or upstream code attempts to set
ssl_minimum_version
(or underlyingssl_version
) to a value lower thanTLSVersion.TLSv1_2
, raise aValueError
—prevent creation of a context allowing insecure protocols. - The check should happen after resolving the minimum version, before setting
context.minimum_version
. - Only edits in
src/snowflake/connector/vendored/urllib3/util/ssl_.py
in the shown region are required. - No new imports or dependencies are necessary, but add an explicit check before setting
context.minimum_version
. - Edits are to lines after line 302, just before setting
context.minimum_version
, to add an additional check.
-
Copy modified lines R301-R306
@@ -298,6 +298,12 @@ | ||
context = SSLContext(PROTOCOL_TLS_CLIENT) | ||
|
||
if ssl_minimum_version is not None: | ||
# Prevent insecure protocols from being allowed | ||
if ssl_minimum_version < TLSVersion.TLSv1_2: | ||
raise ValueError( | ||
"Weak or insecure SSL/TLS protocols (TLSv1/TLSv1.1) are not supported. " | ||
"Please use TLSv1_2 or higher." | ||
) | ||
context.minimum_version = ssl_minimum_version | ||
else: # Python <3.10 defaults to 'MINIMUM_SUPPORTED' so explicitly set TLSv1.2 here | ||
context.minimum_version = TLSVersion.TLSv1_2 |
d83227a
to
9f3d417
Compare
9f3d417
to
2e84e1b
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.
I assume tests can be failing for this branch - without our adjustments (to be added in PR) - so this one looks good 👍
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 #NNNN
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Please write a short description of how your code change solves the related issue.
(Optional) PR for stored-proc connector: