Skip to content

Block integer local-part emails in emailIsBad#1268

Merged
mbifulco merged 1 commit into
mainfrom
copilot/update-emailisbad-check
Jun 13, 2026
Merged

Block integer local-part emails in emailIsBad#1268
mbifulco merged 1 commit into
mainfrom
copilot/update-emailisbad-check

Conversation

Copilot AI commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

emailIsBad previously filtered only by blocked domains, allowing addresses like 123@domain.com through. This update extends the check to also treat integer-only local parts as bad inputs.

  • Email filtering logic

    • Added integer local-part detection in emailIsBad.
    • Preserved existing blocked-domain behavior.
  • Coverage updates

    • Added/updated unit tests for integer local-part handling in:
      • emailIsBad
      • fakeSubscribe
      • subscribe
  • Behavior example

    emailIsBad('123@example.com'); // true
    emailIsBad('user@example.com'); // false
    emailIsBad('test@mailinator.com'); // true

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mikebifulco-com-bnbu Ready Ready Preview, Comment Jun 13, 2026 7:30pm

Copilot AI changed the title Update emailIsBad to block integer local-part emails Block integer local-part emails in emailIsBad Jun 13, 2026
Copilot AI requested a review from mbifulco June 13, 2026 19:28
@mbifulco mbifulco marked this pull request as ready for review June 13, 2026 19:38
Copilot AI review requested due to automatic review settings June 13, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates newsletter subscription anti-abuse logic by expanding emailIsBad to also flag emails whose local-part is integer-only, and extends unit test coverage to ensure fakeSubscribe/subscribe treat those addresses as “bad” inputs.

Changes:

  • Extended emailIsBad to return true when the local-part is composed only of digits.
  • Added unit test coverage for integer-only local parts in emailIsBad, fakeSubscribe, and subscribe.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/utils/resend.ts Updates emailIsBad filtering logic to include integer-only local parts.
src/utils/resend.test.ts Adds tests asserting integer-only local parts are treated as “bad” for filtering and subscription flows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/resend.ts
Comment on lines +241 to +244
const localPart = email.split('@')[0];
const domain = email.split('@')[1]?.toLowerCase();
return BAD_DOMAINS.includes(domain);
const hasIntegerLocalPart = /^\d+$/.test(localPart);
return BAD_DOMAINS.includes(domain) || hasIntegerLocalPart;
@mbifulco mbifulco merged commit 34fddd6 into main Jun 13, 2026
9 checks passed
@mbifulco mbifulco deleted the copilot/update-emailisbad-check branch June 13, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants