The Regex That Trusted Email — JavaScript Bug Hunt
Inspired by the bounce storms behind every "we emailed you a receipt" pipeline: the validator is /.+@.+/, so a@b@c, "has spaces"@x and domains without a dot…
- Language: JavaScript
- Layer: Backend
- Difficulty: Easy
- Concepts: Validation, Regex
- Modelled on: Email-validation lore
- Visible tests: normal addresses pass; double @ and spaces fail; dotless domains and short TLDs fail
- Reward: 50 XP for a complete fix
Briefing
Inspired by the bounce storms behind every "we emailed you a receipt" pipeline: the validator is /.+@.+/, so a@b@c, "has spaces"@x and domains without a dot all get queued, bounce, and tank the sender reputation.
Tighten emailCheck.js to the sane subset.
Bug report
BUG-MX · Reported by: deliverability
isValid(email) — pragmatic rules:
- exactly one "@", no whitespace anywhere
- local part non-empty
- domain contains at least one ".", with a TLD of 2+ letters
Observed: 12% of the queue is structurally impossible addresses.
Logs
[smtp] 550 loop detected for "ceo@corp@corp"The code as shipped
src/mail/emailCheck.js (editable)
// Structural email validation.
exports.isValid = function (email) {
return /.+@.+/.test(email);
};
Open the hunt to edit the files, run the visible tests and submit against the hidden ones. More JavaScript bug hunts.