Code Room
Code reviewMediumcr-g554
Subject Security sensitive data loggingLevel Mid–Senior~15 minCommon in Security interviewsIndustries Software development, IT services

Question

Review this TypeScript payment-charge function.

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 reviewtypescript
async function charge(req: ChargeRequest, logger: Logger) {  logger.info('charge request', {    user: req.userId,    card: req.cardNumber,    cvv: req.cvv,    amount: req.amount,  });  const result = await gateway.charge(req);  if (!result.ok) {    logger.error(`charge failed for ${req.cardNumber}: ${JSON.stringify(req)}`);  }  return result;}
Run or narrate your approach, then ask the coach.