Skip to content

bpo-32951: Disable SSLSocket/SSLObject constructor#5864

Merged
tiran merged 1 commit intopython:masterfrom
tiran:sslsocket_no_instance
Feb 27, 2018
Merged

bpo-32951: Disable SSLSocket/SSLObject constructor#5864
tiran merged 1 commit intopython:masterfrom
tiran:sslsocket_no_instance

Conversation

@tiran
Copy link
Copy Markdown
Member

@tiran tiran commented Feb 24, 2018

Direct instantiation of SSLSocket was never documented nor tested. It
had limitations, too. For example it was not possible to enabled
hostname verification except through ssl_version=PROTOCOL_TLS_CLIENT
with cert_reqs=CERT_REQUIRED.

The only test case for direct instantiation was added a couple of days
ago for IDNA testing.

Signed-off-by: Christian Heimes christian@python.org

https://bugs.python.org/issue32951

@tiran tiran force-pushed the sslsocket_no_instance branch from f26412b to fa2aa15 Compare February 25, 2018 17:23
@tiran tiran changed the title Remove support for instantiation of SSLSocket bpo-32951: Disable SSLSocket/SSLObject constructor Feb 25, 2018
@tiran tiran requested review from alex and pitrou February 25, 2018 17:24
Direct instantiation of SSLSocket and SSLObject objects is now prohibited.
The constructors were never documented, tested, or designed as public
constructors. The SSLSocket constructor had limitations. For example it was
not possible to enabled hostname verification except was
ssl_version=PROTOCOL_TLS_CLIENT with cert_reqs=CERT_REQUIRED.

SSLContext.wrap_socket() and SSLContext.wrap_bio are the recommended API
to construct SSLSocket and SSLObject instances. ssl.wrap_socket() is
also deprecated.

The only test case for direct instantiation was added a couple of days
ago for IDNA testing.

Signed-off-by: Christian Heimes <christian@python.org>
@tiran tiran force-pushed the sslsocket_no_instance branch from fa2aa15 to 47984b8 Compare February 27, 2018 08:23
@tiran tiran merged commit 9d50ab5 into python:master Feb 27, 2018
@bedevere-bot
Copy link
Copy Markdown

@tiran: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington
Copy link
Copy Markdown
Contributor

Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@miss-islington
Copy link
Copy Markdown
Contributor

Sorry, @tiran, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 9d50ab563df6307cabbcc9883cb8c52c614b0f22 3.7

tiran added a commit to tiran/cpython that referenced this pull request Feb 27, 2018
Direct instantiation of SSLSocket and SSLObject objects is now prohibited.
The constructors were never documented, tested, or designed as public
constructors. The SSLSocket constructor had limitations. For example it was
not possible to enabled hostname verification except was
ssl_version=PROTOCOL_TLS_CLIENT with cert_reqs=CERT_REQUIRED.

SSLContext.wrap_socket() and SSLContext.wrap_bio are the recommended API
to construct SSLSocket and SSLObject instances. ssl.wrap_socket() is
also deprecated.

The only test case for direct instantiation was added a couple of days
ago for IDNA testing.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 9d50ab5)

Co-authored-by: Christian Heimes <christian@python.org>
@bedevere-bot
Copy link
Copy Markdown

GH-5925 is a backport of this pull request to the 3.7 branch.

tiran added a commit that referenced this pull request Feb 27, 2018
…5925)

Direct instantiation of SSLSocket and SSLObject objects is now prohibited.
The constructors were never documented, tested, or designed as public
constructors. The SSLSocket constructor had limitations. For example it was
not possible to enabled hostname verification except was
ssl_version=PROTOCOL_TLS_CLIENT with cert_reqs=CERT_REQUIRED.

SSLContext.wrap_socket() and SSLContext.wrap_bio are the recommended API
to construct SSLSocket and SSLObject instances. ssl.wrap_socket() is
also deprecated.

The only test case for direct instantiation was added a couple of days
ago for IDNA testing.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 9d50ab5)

Co-authored-by: Christian Heimes <christian@python.org>
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.

5 participants