Reject author credits if encoded #20649
<!-- codex-pull-request-review-summary -->
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review | Status | Commit | Review trigger |
| --- | --- | --- | --- |
| 📝 Code Review | ✅ Completed <relative-time datetime="2026-10-02T16:39:08.492021Z">2026-10-02T16:39:08.492021Z</relative-time> | 219d94e | PR opened |
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
</details>
🤖 suggested this below but i did whats present instead, happy to go either way or no way (close pr) or whatever we think is best in an effort to not do that decoding thing in #20622
# Require plain Unicode credits rather than MIME encoded-words.
for field in ("author", "author_email", "maintainer", "maintainer_email"):
if (value := getattr(metadata, field)) is not None and "?=" in value:
email_name = _RAW_TO_EMAIL_MAPPING[field]
errors.append(
InvalidMetadata(
email_name,
f"{email_name!r} field must not contain '?='. "
"Use plain Unicode instead of MIME encoded-words.",
)
)
<sub><sub>!P2 Badge</sub></sub> Match MIME encoded words instead of every ?=
When a legitimate plain-text credit contains these adjacent characters, such as Author: Why?= Research Group, this condition rejects the upload even though the value is not MIME-encoded and already uses plain text. Author and maintainer names are free-form strings, so the validation should recognize the complete encoded-word structure (beginning with =? and including its charset/encoding sections) rather than treating the terminator alone as proof of encoding.
Useful? React with 👍 / 👎.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 219d94e604
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
</details>
well.. isnt tht what we are trying to do mr robot?
The change itself seems fine, but I can imagine we might want to measure for this first for a while before hard-banning it 🙂 -- maybe we collect metrics/stats only for now?
Maybe:
"MIME encoded-word syntax is not allowed. Use plain Unicode instead.",
(Since it's not just any MIME encoding, it's specifically the weird RFC 2822 "encoded-word" format.)
matches stuff like
=?utf-8?q?Jos=C3=A9?=
=?UTF-8?B?Sm9zw6k=?=
rm'd the error message for now to gather metrics
req. for review @woodruffw - ive updated to just add metrics for now and ill dashboard it up so we can track
so this rejects values containing ?= at upload time and requires plain Unicode instead.
Does it mean it will simply block uploads for dists built with pdm-backend? Do we have workarounds? A script that patches the metadata while waiting for a change in pdm-backend?
@pawamoy in the original commits initially yes (see e886b0bc77d54dc23), but we've decided that it's unsafe for us to do this (see https://github.com/pypi/warehouse/issues/16496#issuecomment-6356358470) so this just adds metrics to track it in some panes (we could pull in DB, too so im not certain we even need this PR)
I think as mentioned in https://github.com/pypi/warehouse/issues/18930#issuecomment-6375647566 we will probably just no render the section if it has this issue
I see, thank you 🙏
FYI, pdm-backend upgraded its vendored pyproject-metadata in v2.5.0 (released last month), meaning it won't MIME-encode these fields anymore.
will close for now, can see db for data - still need PR to handle not showing the data if bad
JacobCoffee
Some build backends (I think only PDM, really) emit MIME-encoded author and maintainer metadata that PyPI displays literally, so this rejects values containing ?= at upload time and requires plain Unicode instead.
Alternative to #20622
Closes #20622
Fixes #18930