Apologies for the delay in responding to the question with inputs from Product Team.
Can you please check using parameter as input for foreach activity and selecting "Secure String" option for Parameter as shown below. Also, kindly check if secure input and output options in activities used inside foreach activity will help. Hope this helps! Please suggest if this does not cover the scenario and we will be glad to help further.