Skip to content

Conversation

@nshirley
Copy link
Contributor

@nshirley nshirley commented Jan 9, 2026

Because:

  • There is an edge case where aliased email look ups can return wrong bounces

This Commit:

  • Updates the bounce lookup to use a fully normalized email, and an aliased email with wildcard

Closes: FXA-12867

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Any other information that is important to this pull request.

@nshirley nshirley requested a review from a team as a code owner January 9, 2026 16:09
@nshirley nshirley force-pushed the double-match-on-bounce-check branch from 4eb095a to 546dd8a Compare January 9, 2026 16:10
const normalizedEmail = emailNormalization.normalizeEmailAliases(email);
// we need to check for two variants of the email if the normalization
// uses a replace on the alias (e.g. '+' to '%')
const aliasedEmail = emailNormalization.normalizeEmailAliases(email, '+%');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

a couple problems with this, it's hard coded so we can't easily change it on the fly, and we're assuming all aliases should be replaced with a +.

Perhaps a follow up should be to update the bounce config to have a delimiter property for the normalization to reference. i.e. { domain: 'gmail', regex: '...', replace: '', delimiter: '+' } This would allow us to, on the fly, change the regex matching and replace per domain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also don't love this since we will need to update the BOUNCES_EMAIL_ALIAS_NORMALIZATION config to remove the replace value. Since we're trying to create two versions of the email we have to first run it through normalization to remove the aliasing all together, and again to 'wildcard' it:

[email protected] -> [email protected] and test+%@domain.com

@nshirley nshirley force-pushed the double-match-on-bounce-check branch 3 times, most recently from e70b04c to e17fead Compare January 10, 2026 00:33
@nshirley nshirley requested a review from vbudhram January 10, 2026 00:40
return applyRules(bounces);
}

async function checkBouncesWithAliases(email) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good to me! Thanks for fixing that.

@dschom dschom self-requested a review January 12, 2026 19:14
Because:
 - There is an edge case where aliased email look ups can return wrong
   bounces

This Commit:
 - Updates the bounce lookup to use a fully normalized email, and an
   aliased email with wildcard

Closes: FXA-12867
@nshirley nshirley force-pushed the double-match-on-bounce-check branch from e17fead to 6e1f849 Compare January 12, 2026 19:17
@nshirley
Copy link
Contributor Author

last push was just a commit --amend

@nshirley nshirley merged commit a3d9e7a into main Jan 12, 2026
22 checks passed
@nshirley nshirley deleted the double-match-on-bounce-check branch January 12, 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.

4 participants