When the pastor hears the confession of a sinner, this confession is not to be revealed. The confession is strictly protected by Scriptural standard and by the laws of the United States.
This extends to every confessor and every penitent. I know of a case from about 30 years ago where a man was standing trial for murder. It was rumored that he had confessed his guilt to his pastor. The pastor was questioned by the authorities and refused to comment. It was understood that this confessional confidence was sacred. Even after this man was convicted, the pastor kept his mouth shut.
What about those hard cases where the crime is of great harm and the situation is highly emotionally charged? Even then, and especially then, the pastor must keep quiet. What can the pastor do? If possible, the pastor will convince the penitent to “turn himself in” or reveal his guilt to the people he has hurt. The pastor will encourage him to show “fruits of repentance,” paying back or compensating anyone who was hurt.
If a penitent sinner reveals that he has an overwhelming compulsion to hurt people, say, for example, a pedophile who says he cannot stop and will harm a child again, what will the pastor do? In such difficult cases, the pastor will need to follow the penitent closely, provide whatever support he needs to avoid that sin in the future, and make it somehow impossible for him to hurt anyone.
This can be done by insisting the penitent get help. Anyone who is truly repentant will not refuse help to prevent such behavior. In the case of imminent danger, the pastor will need to keep close contact to protect the innocent.
But those are extreme cases. The most important thing is that all sinners who repent feel confident that the act of confessing sin to the pastor is safe and that the confessional is sacred.