Summary
In EmploymentFormService#approveAndFinalizeEmployment, the generated raw password for a new employee is currently returned directly in the API response string:
return "Employment has been approved, generated password for new employee: " + rawPassword;
This poses a security risk because:
- The raw password may be logged by middleware or log aggregators intercepting the HTTP response body.
- It is transmitted over the wire as plain text in the response payload.
- It may be cached by proxies or clients.
Suggested Fix
- Remove the raw password from the returned response string.
- Deliver the password to the new employee via a secure email service (e.g.,
EmailService.sendTemporaryPassword(email, rawPassword)).
- Return a safe confirmation message such as
"Employment approved. Credentials have been sent to the employee's registered email." instead.
- Ensure no log statement includes the raw password.
References
Summary
In
EmploymentFormService#approveAndFinalizeEmployment, the generated raw password for a new employee is currently returned directly in the API response string:This poses a security risk because:
Suggested Fix
EmailService.sendTemporaryPassword(email, rawPassword))."Employment approved. Credentials have been sent to the employee's registered email."instead.References