Skip to content

fix(auth): guard forgot-password email type - #137

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-management-840c
Draft

cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-management-840c

Conversation

@cursor

@cursor cursor Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

Public POST /auth/forgot-password accepted any truthy email value, then called .toLowerCase() on it. A malformed JSON body such as { "email": {} } could throw inside the async Express route before route-level handling, risking a process-level crash on the auth surface.

Root cause

The route only checked if (!email) before normalizing, unlike nearby auth handlers that require string inputs.

Fix

Require email to be a non-empty string before normalization, then reuse the normalized value for lookup.

Validation

  • cd api && npm run build
  • node tests/auth-forgot-password-hardening.test.mjs
  • npx tsc --noEmit
Open in Web View Automation 

cursoragent and others added 2 commits September 21, 2026 05:09
Co-authored-by: Deesmo <Deesmo@users.noreply.github.com>
Co-authored-by: Deesmo <Deesmo@users.noreply.github.com>
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.

1 participant