Skip to content

Fix email ownership check#6505

Merged
kschelonka merged 2 commits intomozilla:mainfrom
st3fan:st3fan/H1-3568986
Mar 11, 2026
Merged

Fix email ownership check#6505
kschelonka merged 2 commits intomozilla:mainfrom
st3fan:st3fan/H1-3568986

Conversation

@st3fan
Copy link
Copy Markdown
Contributor

@st3fan st3fan commented Feb 24, 2026

This is a small fix for an incorrect object ownership check in the resend-email endpoint.

See https://hackerone.com/reports/3568986 for the full discussion. (May only be accessible to the Mozilla Security Team.)

The report was not accepted by the H1 team because I do not have the time to explore this further. The bug is real though and I hope this is a contribution for a fix you will take anyway.

👋🏻 ❤️ 🦊

@kschelonka kschelonka enabled auto-merge February 24, 2026 22:10
auto-merge was automatically disabled February 25, 2026 01:48

Head branch was pushed to by a user without write access

@kschelonka kschelonka enabled auto-merge February 25, 2026 17:17
@kschelonka kschelonka added this pull request to the merge queue Feb 25, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 25, 2026
@st3fan
Copy link
Copy Markdown
Contributor Author

st3fan commented Feb 25, 2026

@kschelonka Should I contribute a test for the endpoint that i changed? I a not super familiar with these frameworks but I can try.

@kschelonka
Copy link
Copy Markdown
Collaborator

kschelonka commented Feb 27, 2026

@kschelonka Should I contribute a test for the endpoint that i changed? I a not super familiar with these frameworks but I can try.

Yeah, it would be nice since ideally should have triggered a failure. It's somewhat burdensome to test this whole endpoint, although easier now with the new integration test pattern. You could consider a small refactor to test a smaller unit alone, e.g. lines 37-41 could be refactored into a function like export userHasEmail(emailId: number, subscriberId: number): Promise<boolean>. Or for a pure unit test you could essentially export the filter behavior as its own method taking the email list and subscriber as inputs.

For testing you can model after BreachNotificationSubscriber for integration tests that use the database directly rather than setting up a db mock. We introduced recently so it's not a widespread pattern yet.

@kschelonka
Copy link
Copy Markdown
Collaborator

This is an obvious bug though, so if it's burdensome for you to add test coverage we can proceed and make a ticket for the team to improve coverage of this endpoint.

@kschelonka kschelonka added this pull request to the merge queue Feb 27, 2026
@kschelonka kschelonka removed this pull request from the merge queue due to a manual request Feb 27, 2026
@kschelonka kschelonka added this pull request to the merge queue Mar 11, 2026
Merged via the queue into mozilla:main with commit c6a270c Mar 11, 2026
11 of 12 checks passed
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.

2 participants