GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — email.utils.parseaddr(strict=True) silently splices inline comments in the local-part · Issue #159475 · python/cpython

email.utils.parseaddr(strict=True) silently splices inline comments in the local-part #159475

New issue
Copy link
New issue
Copy link
Open
#159618
Open
email.utils.parseaddr(strict=True) silently splices inline comments in the local-part#159475
#159618
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@D3e4mlike
D3e4mlike
opened on Oct 15, 2026
Issue body actions

email.utils.parseaddr() and getaddresses(), even in strict=True mode (the default since the CVE-2023-27043 fix), silently drop a comment that is embedded inside a dot-atom and splice the surrounding atoms together:

>>> from email.utils import parseaddr
>>> parseaddr('u(comment)[email protected]', strict=True)
('comment comment', '[email protected]')

The strict parser rejects the same input:

>>> from email.headerregistry import Address
>>> Address(addr_spec='u(comment)[email protected]')
InvalidHeaderDefect: local-part is not dot-atom, quoted-string, or obs-local-part

So a caller that validates or authorizes with parseaddr and then hands the original string to a strict component gets a subject mismatch — the same class as CVE-2019-11340 and the motivation for CVE-2023-27043.

Proposal: in strict mode, fail closed (return ('', '')) when a comment is embedded inside a dot-atom instead of splicing. strict=False would keep the historical lenient behavior. I'm happy to prepare a PR.

Reproduced on CPython 3.14.6.

Linked PRs

  • gh-159475: Make parseaddr() reject inline comments in strict mode #159477
  • gh-159475: Make parseaddr() reject inline comments in strict mode #159618

Activity

  1. aisk
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    topic-email
    on Oct 15, 2026
  2. D3e4mlike
    added 2 commits that reference this issue on Oct 17, 2026

    pythongh-159475: Make parseaddr() reject inline comments in strict mode

    c8d9326

    pythongh-159475: Make parseaddr() reject inline comments in strict mode

    f31dc7e
  3. kevinprimeraquecreo-stack
    added this to Project_VKand Project_VKon Oct 18, 2026
  4. github-project-automation
    moved this to In progress in Project_VKon Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.