This article proposes a novel strategy for enhancing secure wireless communication through the use of a simultaneously transmitting and reflecting reconfigurable intelligent surface (STAR-RIS) in a multiple-input single-output system. In the presence of energy-harvesting eavesdroppers, the study aims to maximize the secrecy rate while adhering to strict energy harvesting constraints. By dynamically manipulating the wireless environment with the STAR-RIS, the research examines the balance between harvested energy and secrecy rate under two key protocols: energy splitting and mode selection. The study addresses both imperfect and perfect channel state information (CSI) and formulates a complex non-convex optimization problem, which is solved using a penalty concave convex procedure combined with an alternating optimization algorithm. The method optimizes beamforming and STAR-RIS transmission and reflection coefficients to achieve a optimal balance between secure communication and energy harvesting constraints. Numerical simulations show that the proposed approach is effective, even with imperfect CSI, and outperforms conventional RIS methods in terms of robust security and energy performance.