Skip to content
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

Drop 'six' dependency from base check package #18641

Merged
merged 9 commits into from
Oct 25, 2024

Conversation

iliakur
Copy link
Contributor

@iliakur iliakur commented Sep 20, 2024

What does this PR do?

Drop the six dependency from the base check.
No changelog because we officially dropped Python 2 support already.

Motivation

Additional Notes

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Changelog entries must be created for modifications to shipped code
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

Copy link

The validations job has failed; please review the Files changed tab for possible suggestions to resolve.

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

Attention: Patch coverage is 92.68293% with 6 lines in your changes missing coverage. Please review.

Project coverage is 88.52%. Comparing base (007064f) to head (feb9487).
Report is 1 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
activemq ?
activemq_xml 82.20% <ø> (ø)
ambari 85.75% <ø> (ø)
appgate_sdp 93.93% <ø> (ø)
arangodb 98.23% <ø> (ø)
avi_vantage 91.35% <ø> (ø)
aws_neuron 92.42% <ø> (ø)
azure_iot_edge 82.08% <ø> (ø)
btrfs 83.33% <ø> (ø)
cassandra 66.66% <ø> (ø)
cisco_aci 89.59% <ø> (ø)
citrix_hypervisor 87.50% <ø> (ø)
cloud_foundry_api 96.11% <ø> (ø)
cloudera 99.51% <ø> (ø)
crio 89.79% <ø> (ø)
datadog_checks_downloader 81.35% <ø> (+3.23%) ⬆️
datadog_cluster_agent 90.19% <ø> (ø)
dcgm 93.54% <ø> (ø)
directory 96.46% <ø> (ø)
disk 89.44% <ø> (ø)
dns_check 93.81% <ø> (ø)
ecs_fargate 83.71% <ø> (ø)
eks_fargate 94.05% <ø> (ø)
external_dns 89.28% <ø> (ø)
go_expvar 92.66% <ø> (ø)
hive ?
hivemq 61.90% <ø> (ø)
ibm_i 82.36% <ø> (ø)
ignite ?
jboss_wildfly ?
kafka ?
karpenter 95.06% <ø> (ø)
kube_controller_manager 97.88% <ø> (ø)
kube_dns 95.94% <ø> (ø)
kube_metrics_server 94.87% <ø> (ø)
kubeflow 93.22% <ø> (ø)
kubelet 91.09% <ø> (ø)
kubernetes_cluster_autoscaler 93.22% <ø> (ø)
kyototycoon 85.96% <ø> (ø)
presto ?
solr ?

Flags with carried forward coverage won't be shown. Click here to find out more.

try:
context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS)
context.verify_mode = ssl.CERT_NONE

with closing(context.wrap_socket(sock, server_hostname=hostname)) as secure_sock:
with context.wrap_socket(sock, server_hostname=hostname) as secure_sock:

Check failure

Code scanning / CodeQL

Use of insecure SSL/TLS version High

Insecure SSL/TLS protocol version TLSv1 allowed by
call to ssl.SSLContext
.
Insecure SSL/TLS protocol version TLSv1_1 allowed by
call to ssl.SSLContext
.

Copilot Autofix AI 3 days ago

To fix the problem, we need to ensure that the SSL context is created using a secure protocol version. The best way to do this is to use ssl.PROTOCOL_TLSv1_2 or higher. This change will ensure that only secure versions of the TLS protocol are used, aligning with best practices for secure communication.

  • Change the SSL context creation to use ssl.PROTOCOL_TLSv1_2.
  • Ensure that the rest of the functionality remains unchanged.
Suggested changeset 1
datadog_checks_base/datadog_checks/base/utils/http.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/datadog_checks_base/datadog_checks/base/utils/http.py b/datadog_checks_base/datadog_checks/base/utils/http.py
--- a/datadog_checks_base/datadog_checks/base/utils/http.py
+++ b/datadog_checks_base/datadog_checks/base/utils/http.py
@@ -465,3 +465,3 @@
             try:
-                context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS)
+                context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLSv1_2)
                 context.verify_mode = ssl.CERT_NONE
EOF
@@ -465,3 +465,3 @@
try:
context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS)
context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLSv1_2)
context.verify_mode = ssl.CERT_NONE
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link

The validations job has failed; please review the Files changed tab for possible suggestions to resolve.

Copy link

The validations job has failed; please review the Files changed tab for possible suggestions to resolve.

Copy link

The validations job has failed; please review the Files changed tab for possible suggestions to resolve.

HadhemiDD
HadhemiDD previously approved these changes Oct 22, 2024
@iliakur iliakur added this pull request to the merge queue Oct 25, 2024
Merged via the queue into master with commit d5dec12 Oct 25, 2024
281 of 288 checks passed
@iliakur iliakur deleted the ik/AI-4133/drop-six-from-base-check branch October 25, 2024 08:19
github-actions bot pushed a commit that referenced this pull request Oct 25, 2024
* Drop 'six' dependency from base check package

* fix time_func

* bring six back as dependency

* Drop six again, this time from agent requirements as well

* remove six from 3rdparty licenses

* Drop six from prometheus-related code d5dec12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants