🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
HTML MASTER CLASS /// LEARN TAGS /// BUILD STRUCTURE /// SEMANTIC WEB /// HTML MASTER CLASS /// LEARN TAGS ///

Untitled Lesson

Total XP: 0|💻 backend XP: 0

Skill Matrix

UNLOCK NODES BY LEARNING NEW TAGS.

Select an unlocked node to view details root

Pascual Vila

Pascual Vila

Frontend Instructor // Code Syllabus

Common Pitfalls & Errors

The Error //

Returning a different response depending on whether a submitted email corresponds to an existing account

// Wrong: leaks account existence via a different response if (!userExists) return res.status(404).json({ error: "Email not found" }); // Correct: identical response either way res.json({ message: "If that email exists, a reset link has been sent" });

The Solution //

A distinguishable response (like a specific "email not found" error) lets an attacker systematically enumerate which email addresses correspond to real accounts on the platform by testing many emails and observing the different responses — the reset request endpoint should always return an identical response regardless of whether the account actually exists.

The Error //

Storing password reset tokens in plaintext, or with no enforced expiration

// Wrong: plaintext, no expiration enforced await db.resetTokens.insert({ token: resetToken, userId }); // Correct: hashed, with a strictly enforced short expiration await db.resetTokens.insert({ token: hashToken(resetToken), userId, expiresAt: Date.now() + 3600000 });

The Solution //

A plaintext reset token is exactly as dangerous as a plaintext password if the database is ever compromised, letting an attacker immediately reset any account whose token hasn't expired. A token with no enforced expiration remains a valid attack surface indefinitely, long after any legitimate reset attempt would have completed.

Continue Learning