Skip to content

Security: Replace raw password in API response with secure email delivery #56

Description

@coderabbitai

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions