Author aclover
Recipients aclover
Date 2014-02-25.18:20:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393352419.14.0.647705184863.issue20770@psf.upfronthosting.co.za>
In-reply-to
Content
When an SMTP server responds to the STARTTLS command with an error, the smtplib.SMTP.starttls() method does not raise an exception, as it would if TLS negotiation itself failed. Consequently naïve callers of the function may assume that a TLS connection has actually been established and continue to send sensitive mail through the interface.

In reality starttls() returns a tuple of response code and message from which the fail state can be detected, but this is not documented and no caller code I've met does anything with it.

Either:

1. Treat it as a doc bug for 3.4. The return value should be documented and callers warned that they need to check that value[0]==220 before assuming they have negotiated TLS. Or,

2. starttls() should raise SMTPResponseException for responses other than 220 in a future Python version, especially if moving towards validate-by-default. Possibly only raise an exception if the SSLContext.verify_mode is REQUIRED?
History
Date User Action Args
2014-02-25 18:20:19acloversetrecipients: + aclover
2014-02-25 18:20:19acloversetmessageid: <1393352419.14.0.647705184863.issue20770@psf.upfronthosting.co.za>
2014-02-25 18:20:19acloverlinkissue20770 messages
2014-02-25 18:20:18aclovercreate