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

starttls: Clear unencrypted commands from buffer #380

Merged
merged 2 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions aiosmtpd/docs/NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

.. towncrier release notes start

1.4.6 (2024-05-06)
==================

* STARTTLS is now fully enforced if used.

1.4.5 (2024-03-02)
==================
Expand Down
3 changes: 3 additions & 0 deletions aiosmtpd/smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ def connection_made(self, transport: asyncio.BaseTransport) -> None:
self._reader._transport = transport # type: ignore[attr-defined]
self._writer._transport = transport # type: ignore[attr-defined]
self.transport = transport
# Discard any leftover unencrypted data
# See https://tools.ietf.org/html/rfc3207#page-7
self._reader._buffer.clear() # type: ignore[attr-defined]
# Do SSL certificate checking as rfc3207 part 4.1 says. Why is
# _extra a protected attribute?
assert self._tls_protocol is not None
Expand Down
Loading