Skip to content

[3.12] gh-143923: Reject control characters in POP3 commands - #162136

Open
saakshaat-singh wants to merge 1 commit into
python:3.12from
saakshaat-singh:ssingh/312-pop3-command-validation-v2
Open

saakshaat-singh wants to merge 1 commit into
python:3.12from
saakshaat-singh:ssingh/312-pop3-command-validation-v2

Conversation

@saakshaat-singh

Copy link
Copy Markdown

Before this PR

Python 3.12.16 permits control characters in POP3 commands. If untrusted input reaches a username, password, or another command argument, CR/LF can introduce additional protocol commands (CVE-2025-15367).

After this PR

==COMMIT_MSG==
==COMMIT_MSG==

This backports GH-143924 to reject C0 control characters and DEL in _putcmd before writing to the connection. Ordinary commands retain their existing encoding and wire representation.

Upstream context

The original change was merged on main, but maintainers withheld backports because of compatibility concerns, including passwords containing control characters. A later 3.13/3.14 backport request was closed in favor of that discussion.

This PR asks maintainers to reconsider the same policy for 3.12. It does not establish that the earlier compatibility concern has been resolved. The source change follows the existing upstream implementation; the requested decision is whether its rejection behavior is appropriate for this stable branch.

Validation

The focused test_poplib suite completed 74 tests with the changed sources and a Python 3.12 interpreter. Regression coverage exercises all C0 characters and DEL in usernames and passwords for POP3 and POP3_SSL. CPython's configured pre-commit checks passed.

Review and next steps

  1. Seek review from the python/email-team code owners in this PR and the existing GH-143923 discussion, with an explicit decision on the prior backport objection.
  2. If the maintainers and 3.12 release manager accept the compatibility tradeoff, complete the CLA and CI requirements before merge and inclusion in a subsequent 3.12 release.
  3. For an idle review, follow the documented process: follow up on the issue after one month, then use Core Development Discourse after a further week without a response.

Refs #143923

Testing

Possible downsides?

Credentials containing control characters, such as TAB or backspace, may have worked previously and will now raise ValueError. This is the compatibility concern that led upstream to withhold backports.

Are Docs needed?

@python-cla-bot

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant