Skip to content

merge in release/0.9.4 - #1

Merged
tamaralyne merged 1 commit into
masterfrom
feature-update-packages
Sep 23, 2025
Merged

merge in release/0.9.4#1
tamaralyne merged 1 commit into
masterfrom
feature-update-packages

Conversation

@tamaralyne

Copy link
Copy Markdown

No description provided.

context.verify_mode = msg.get('ssl_verify', ssl.CERT_REQUIRED)
with probe_tcp(msg, close=False) as connection:
try:
with context.wrap_socket(

Check failure

Code scanning / CodeQL

Use of insecure SSL/TLS version High

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

Copilot Autofix

AI 12 months ago

The best way to address this issue is to ensure that the SSL context (ssl.SSLContext) used in probe_ssl() explicitly disallows insecure protocols. The most direct approach, supported in Python 3.7 and newer, is to set context.minimum_version = ssl.TLSVersion.TLSv1_2. This forcibly disables TLS versions prior to 1.2, guaranteeing only secure protocols are negotiated. For older Python versions, you would add context options to turn off older protocols, but since the file uses create_default_context() (introduced in 3.4) and can be reasonably expected to run on modern Pythons, setting minimum_version is best. The change should be applied in probe_ssl(), after the context is created (after line 92, on a new line before context.verify_mode = ...). No new imports are required.

Suggested changeset 1
pyroute2/netlink/rtnl/probe_msg.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/pyroute2/netlink/rtnl/probe_msg.py b/pyroute2/netlink/rtnl/probe_msg.py
--- a/pyroute2/netlink/rtnl/probe_msg.py
+++ b/pyroute2/netlink/rtnl/probe_msg.py
@@ -90,6 +90,7 @@
 def probe_ssl(msg):
     hostname = msg.get('hostname') or msg.get('dst')
     context = ssl.create_default_context()
+    context.minimum_version = ssl.TLSVersion.TLSv1_2
     context.verify_mode = msg.get('ssl_verify', ssl.CERT_REQUIRED)
     with probe_tcp(msg, close=False) as connection:
         try:
EOF
@@ -90,6 +90,7 @@
def probe_ssl(msg):
hostname = msg.get('hostname') or msg.get('dst')
context = ssl.create_default_context()
context.minimum_version = ssl.TLSVersion.TLSv1_2
context.verify_mode = msg.get('ssl_verify', ssl.CERT_REQUIRED)
with probe_tcp(msg, close=False) as connection:
try:
Copilot is powered by AI and may make mistakes. Always verify output.
@tamaralyne
tamaralyne merged commit 5e2b3a6 into master Sep 23, 2025
3 of 26 checks passed
@tamaralyne
tamaralyne deleted the feature-update-packages branch September 23, 2025 19:07
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.

2 participants