ssl.wrap_socket() gots removed within python 3.12
Closed this issue · 0 comments
pfichtner commented
gh-94199: Remove the ssl.wrap_socket() function, deprecated in Python 3.7: instead, create a ssl.SSLContext object and call its ssl.SSLContext.wrap_socket method. Any package that still uses ssl.wrap_socket() is broken and insecure. The function neither sends a SNI TLS extension nor validates server hostname. Code is subject to CWE-295: Improper Certificate Validation. Patch by Victor Stinner.
Build fails using Python 3.12
ImportError: cannot import name 'wrap_socket' from 'ssl' (/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/ssl.py):
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/platformio/builder/main.py", line 188:
env.SConscript("$BUILD_SCRIPT")
File "/home/runner/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 597:
return _SConscript(self.fs, *files, **subst_kw)
File "/home/runner/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 285:
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "/home/runner/.platformio/platforms/espressif8266/builder/main.py", line 238:
target_elf = env.BuildProgram()
File "/home/runner/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
return self.method(*nargs, **kwargs)
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/platformio/builder/tools/piobuild.py", line 61:
env.ProcessProjectDeps()
File "/home/runner/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
return self.method(*nargs, **kwargs)
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/platformio/builder/tools/piobuild.py", line 137:
plb = env.ConfigureProjectLibBuilder()
File "/home/runner/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
return self.method(*nargs, **kwargs)
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/platformio/builder/tools/piolib.py", line 1178:
lib_builders = env.GetLibBuilders()
File "/home/runner/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
return self.method(*nargs, **kwargs)
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/platformio/builder/tools/piolib.py", line 1089:
lb = LibBuilderFactory.new(env, lib_dir)
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/platformio/builder/tools/piolib.py", line 60:
obj = globals()[clsname](env, path, verbose=verbose)
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/platformio/builder/tools/piolib.py", line 154:
self.process_extra_options()
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/platformio/builder/tools/piolib.py", line 302:
self.env.SConscript(
File "/home/runner/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 597:
return _SConscript(self.fs, *files, **subst_kw)
File "/home/runner/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 285:
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "/home/runner/work/SipDoorbell/SipDoorbell/.pio/libdeps/nodemcuv2/ESP8266 IoT Framework/scripts/preBuild.py", line 21:
from preBuildCertificates import preBuildCertificatesFun
File "/home/runner/work/SipDoorbell/SipDoorbell/.pio/libdeps/nodemcuv2/ESP8266 IoT Framework/scripts/preBuildCertificates.py", line 23:
from ssl import wrap_socket, CERT_NONE, PROTOCOL_SSLv23