Email validation accepts a trailing newline
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start with EMAIL_PATTERN and validate_email in backend/utils/validation, since its trailing $ lets a final LF match. Then check how UserForm in backend/endpoints/forms/identity preserves the value. Run the reproduction script from the issue to confirm LF and CRLF behave differently. Done when both trailing-newline variants are rejected consistently and the existing validation tests still pass.
Written by the indexing model from the issue text.
Description
RomM version
master at eb10d95813a832ece0219b495a30400ad5a993c1.
Describe the bug
validate_email accepts an otherwise valid address ending in a single LF character, for example "[email protected]\n". UserForm preserves that character. The user endpoints validate this value and then lowercase it without removing the newline.
To Reproduce
With the backend dependencies installed and Python 3.14, run from the repository root:
PYTHONPATH=backend python - <<'PY'
from endpoints.forms.identity import UserForm
from utils.validation import ValidationError, validate_email
for address in ("[email protected]", "[email protected]\n", "[email protected]\r\n"):
email = UserForm.model_validate({"email": address}).email
try:
validate_email(email)
except ValidationError:
print(repr(email), "rejected")
else:
print(repr(email), "accepted")
PY
Observed: the ordinary address and LF-terminated address are accepted; the CRLF-terminated address is rejected.
Expected behavior
An address containing a trailing newline is rejected consistently.
Server
Reproduced on macOS with Python 3.14.9. A regression test also confirms that updating a user email through PUT /api/users/{id} accepts the LF-terminated value before the fix.
Additional context
EMAIL_PATTERN ends with $, which Python can match immediately before a final newline. The existing ASCII-only check permits LF. The confirmed problem is inconsistent email validation; no downstream mail-header or authentication impact is claimed.
- Dominant language
- Python
- Stars
- 13.3k
- Forks
- 747
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 183
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rommapp/romm
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
[Feature] Warn about unknown platform values in config.yml bindingsPossibly taken @NevesHenry claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
rommapp/romm#4178 · 1 reaction ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
OCA/account-invoicing#2529 ·
Maintainers usually reply within 1 day
-
area/ci
Difficulty 1/5 Under an hour Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
ImageGen generate-batch aborts valid JSONL jobs containing a Unicode line separator in poster textOpenbug imagen skills
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day