Code Room
Code reviewMediumcr-g572
Subject Redos security vulnerabilityLevel Mid–Senior~25 minCommon in Security interviewsIndustries Software development

Question

Review this JavaScript input-validation helper (Node.js).

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewjs
// validate an email-like string from an unauthenticated signup formfunction isValidEmail(input) {  const re = /^([a-zA-Z0-9]+)+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;  return re.test(input);} app.post('/signup', (req, res) => {  if (!isValidEmail(req.body.email)) {    return res.status(400).send('invalid email');  }  createAccount(req.body.email);});
Run or narrate your approach, then ask the coach.