Code RoomLogin logs expose secrets
MediumPrep Room Coding #2166

Login logs expose secrets

Code reviewCode quality & reviewMid–Senior~16 min

Review this Java login handler's logging.

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.

0:00 of about 16 min
Mark a line and say what kind of problem it is.0 findings
1Response login(LoginRequest req) {
2 log.info("Login attempt: {}", req); // req.toString() includes all fields
3 User u = userService.authenticate(req.getEmail(), req.getPassword());
4 if (u == null) {
5 log.warn("Failed login for {} with password {}", req.getEmail(), req.getPassword());
6 return Response.unauthorized();
7 }
8 log.info("Issued token {} for {}", u.getSessionToken(), u.getEmail());
9 return Response.ok(u.getSessionToken());
10}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.